What fields are actually required vs optional in the REST API

Hello,

I’m exploring the REST API to setup some automatic realm creation for integration testing. From the documentation it looks like all fields are optional but that is not true as I get json decoding exceptions in the Keycloak log if I’m missing some fields.

My question then is how do I read the code (I suppose) to figure out what fields are required or not? Also is it possible to update the documentation to reflect this?

Have a great day
David

Hi,

By documentation you are talking about Keycloak Admin REST API ? In this case, I think all fields are optional because it is also a return type in which indeed all fields are optional…

Maybe you could get these informations from admin interface ?

Regards

If it was all optional then I would assume this would be valid, but it fails in the parsing stage of the client representation

    {
        "realm": "example-realm",
        "clients": {
            "clientId": "example-api",
            "secret": "mypredefinedsecret",
        }
    }

I will have a look into what the admin interface does and see if I can use any of that.

Thanks