And of course if the realm does not yet exist in the target server you have
to create it first:
$ kcadm.sh create realms -s realm=demorealm -s enabled=true
On Thu, Feb 22, 2018 at 4:12 PM, Marko Strukelj <mstrukel(a)redhat.com> wrote:
You can achieve that by using Admin CLI (for example - if you have
exported a demorealm.json using boot time export, you can import it into a
live server as follows):
$ kcadm.sh create -r demorealm partialImport -s ifResourceExists=FAIL -o
-f - < demorealm.json
Basically you POST the demorealm.json as a body to
http://localhost:8080/auth/admin/realms/demorealm/partialImport
And you add additional attribute into realm JSON body ("ifResourceExists":
"FAIL").
If you only want to add extra things into existing realm, you can use
"SKIP". And there is also "OVERWRITE" which you probably want to
avoid.
On Wed, Feb 21, 2018 at 12:58 AM, Michael Yoder <myoder(a)cloudera.com>
wrote:
> I've got the json from a realm export. Now I'd like to re-create that
> realm
> using the keycloak-admin-client library. Is there any sample code out
> there? Hints?
> I've found
>
>
http://www.keycloak.org/docs/3.4/server_development/#admin-rest-api
>
> and
>
>
http://www.keycloak.org/docs-api/3.4/javadocs/
>
> and even
>
>
https://github.com/keycloak/keycloak/blob/master/integration
> /admin-client/src/main/java/org/keycloak/admin/client/
> resource/RealmResource.java
>
> I feel like I've got parts of it, but I don't know how to put the pieces
> together. Any help would be appreciated.
>
> Thanks,
> -Mike Yoder
> _______________________________________________
> keycloak-user mailing list
> keycloak-user(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/keycloak-user
>