I've tried to import a realm from java application, but the server always return:
Exception in thread "main" javax.ws.rs.BadRequestException: HTTP 400 Bad Request
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.handleErrorStatus(ClientInvocation.java:197)
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:50)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64)
at com.sun.proxy.$Proxy20.create(Unknown Source)
at com.blulogix.core.rest.util.TestKeycloakToken.createRealm(TestKeycloakToken.java:59)
at com.blulogix.core.rest.util.TestKeycloakToken.main(TestKeycloakToken.java:38)
and this is my code:
Keycloak kc = Keycloak.getInstance("http://localhost:8080/auth", "master", "admin", "admin", "security-admin-console");
RealmRepresentation rr = new RealmRepresentation();
rr.setId("TestRealm2");
rr.setRealm("TestRealm2");
rr.setEnabled(true);
Code for adding a new user to any realm are worked.
kc.realm("master").users().create(user);
Please, Can anyone help me out with importing realm??