Aruna.Silva Posted August 27, 2013 Share Posted August 27, 2013 Hi all ,I'm trying to create a user in jasper report server using its extended REST web service APIurl what im calling is : http://localhost:8080/jasperserver-pro/rest/user and following is the user descriptor I'm sending. <user><username>Alice</username><password>password</password><fullName>Alice Adams</fullName><tenantId>tenantOrg</tenantId></user> Once I called that REST API with above given userDescriptor it gives me an error as follows INFO [com.jaspersoft.jasperserver.rest.sample.RestAPIUtils] response status line: HTTP/1.1 400 Bad Request appreciate if somebody can help me to resolve this issue im suffering. Thanks. Link to comment Share on other sites More sharing options...
waal Posted August 28, 2013 Share Posted August 28, 2013 It seems that you're descriptor is correct, when I use it at the same url it works. Are you using a PUT request ? Link to comment Share on other sites More sharing options...
csaurav80 Posted September 2, 2013 Share Posted September 2, 2013 I am trying to create a new user by jasper rest user service api. But I always get 400 bad request and this is what, I am trying. Can anyone point me what I am doing wrong ? curl -i -u jasperadmin:jasperadmin -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d '{"username":"mynewuser","password":"mynewuser","fullName":"NEWUSER":"emailAddress:"user_1@test.com"}' "http://localhost:8080/jasperserver/rest/user/" HTTP/1.1 400 Bad Request Server: Apache-Coyote/1.1 Pragma: No-cache Cache-Control: no-cache Expires: Thu, 01 Jan 1970 05:30:00 GMT+05:30 P3P: CP="ALL" Set-Cookie: JSESSIONID=F7394A9F7348C22E4B264FBCEB6B828F; Path=/jasperserver Content-Type: text/html;charset=UTF-8 Content-Length: 971 Date: Mon, 02 Sep 2013 10:32:21 GMT Connection: close Link to comment Share on other sites More sharing options...
waal Posted September 2, 2013 Share Posted September 2, 2013 When I run the following curl command: curl -i -u superuser:superuser -X PUT -H "Content-Type:text/xml" -H "Accept:text/xml" -d 'Fozzie123Fozzie Beardeveldb' "http://localhost:8080/jasperserver-pro/rest/user" I get this output: HTTP/1.1 201 Created Server: Apache-Coyote/1.1 Cache-Control: private Expires: Thu, 01 Jan 1970 01:00:00 CET P3P: CP="ALL" Set-Cookie: JSESSIONID=1D193052E4313ADA2B66E073304F5756; Path=/jasperserver-pro/; HttpOnly Content-Type: text/xml;charset=UTF-8 Transfer-Encoding: chunked Vary: Accept-Encoding Date: Mon, 02 Sep 2013 12:45:43 GMT I'm not sure if jasper also supports json as request, the examples I could find are only with XML. I'm also not sure if you have to give the organization with the username. We are using the pro version, so jasperadmin is linked to an organisation there. Link to comment Share on other sites More sharing options...
bquinn Posted November 29, 2013 Share Posted November 29, 2013 You need to set externallyDefined along with enabled. Also if role or user is in an org, that should be specified. e.g.curl -u superuser:superuser -X PUT -H "Content-Type: text/plain" -d @ops_user.xml "http://localhost:8080/jasperserver-pro/rest/user/" where ops_user.xml is..<user> <enabled>true</enabled> <externallyDefined>false</externallyDefined> <username>johndoe</username> <password>myPassword</password> <fullName>John Doe</fullName> <tenantId>organization_1</tenantId> <emailAddress>john.doe@mail.com</emailAddress> <roles> <externallyDefined>false</externallyDefined> <roleName>ROLE_OPS</roleName> <tenantId>organization_1</tenantId> </roles></user> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now