The reason of that blog post is, that the information in the REST API documentation wasn’t detailed enough for me. The image shows what I found first in the Keycloak REST API documentation .
In common it’s very simple to use the Keycloak REST API. For more details see in my blog post Getting started to secure a simple Java Microservice with Keycloak, MicroProfile and OpenLiberty.
First you need a bearer authorization token for an administration user and with that token you create a new realm using the realm json exported before.
Here is what I found:
- … for the Authorization user for administrative tasks, I got the missing pieces in the Keycloak documentation here.
- … for the submit of the realm json, I got the missing pieces as a part of the answer on StackOverflow “Unable to create Keycloak realm via the rest admin API: Unsupported Media Type“.