From: Tim K. <t.k...@fz...> - 2018-03-01 07:20:10
|
Dear Krzysztof, i want to add new users with the REST API of Unity. While creating the user and move them to the right group is no problem, i have problems to set a credential. I am not sure about the JSON Object i have to add. What i do right now is: URL = '...rest-admin/v1/entity/train015/credential/train:password?identityType=userName' Header = {'Content-Type': 'application/json', 'Authorization': 'Basic nmVfdGUkbWluOmc4OWYrbyFFeG2mVHRtaEQlZ3RQ'} Data = ??? i tried a lot, last try was: {'true': '["{\\"password\\":\\"newPass1!\\"}"]'} When i set another Key in Data (like 'value') i receive "Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'values': was expecting ('true', 'false' or 'null')" Because of this i tried the 'true' key. Right now i get this error message in Unity Log: 2018-03-01T08:17:36,327 [qtp988637485-277] ERROR unity.server.rest.JSONParsingExceptionMapper: JSON parse error during RESTful API invocation pl.edu.icm.unity.rest.exception.JSONParsingException: Request body must be a JSON array at pl.edu.icm.unity.restadm.RESTAdmin.setCredentialByUser(RESTAdmin.java:395) ~[unity-server-rest-admin-2.4.1.jar:?] at sun.reflect.GeneratedMethodAccessor261.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151] at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) ~[cxf-core-3.1.10.jar:3.1.10] at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[cxf-core-3.1.10.jar:3.1.10] at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189) [cxf-rt-frontend-jaxrs-3.1.10.jar:3.1.10] at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) [cxf-rt-frontend-jaxrs-3.1.10.jar:3.1.10] at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.1.10.jar:3.1.10] at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.1.10.jar:3.1.10] at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.1.10.jar:3.1.10] at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.1.10.jar:3.1.10] at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:262) [cxf-rt-transports-http-3.1.10.jar:3.1.10] at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.1.10.jar:3.1.10] at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.1.10.jar:3.1.10] at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.1.10.jar:3.1.10] at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180) [cxf-rt-transports-http-3.1.10.jar:3.1.10] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:299) [cxf-rt-transports-http-3.1.10.jar:3.1.10] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:235) [cxf-rt-transports-http-3.1.10.jar:3.1.10] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) [javax.servlet-api-3.1.0.jar:3.1.0] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:274) [cxf-rt-transports-http-3.1.10.jar:3.1.10] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860) [jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) [jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) [jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335) [jetty-rewrite-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:455) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.Server.handle(Server.java:530) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256) [jetty-server-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) [jetty-io-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) [jetty-io-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:289) [jetty-io-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:149) [jetty-io-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) [jetty-io-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) [jetty-io-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121] at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626) [jetty-util-9.4.8.v20171121.jar:9.4.8.v20171121] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151] Can you show me a working Data JSON Object? I don't know how to create a JSON Object, so Unity accepts it as a 'JSON array'. Thank you and best regards, Tim Kreuzer -- M.Sc. Tim Kreuzer Federated Systems and Data Jülich Supercomputing Centre, http://www.fz-juelich.de/jsc Phone: +49 2461 61-1583 ----------------------------------------------------------------------- ----------------------------------------------------------------------- Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Sebastian M. Schmidt ----------------------------------------------------------------------- ----------------------------------------------------------------------- |