error when creating a user through the jasper REST api

Hi all ,

I'm trying to create a user in jasper report server using its extended REST web service API

url what im calling is : http://localhost:8080/jasperserver-pro/rest/user and following is the user descriptor I'm sending.


<fullName>Alice Adams</fullName>
Once I called that REST API with above given userDescriptor it gives me an error as follows
INFO [] response status line: HTTP/1.1 400 Bad Request
appreciate if somebody can help me to resolve this issue im suffering.
Aruna.Silva's picture
Joined: Apr 23 2013 - 4:15am
Last seen: 9 years 7 months ago

2 Answers:

It seems that you're descriptor is correct, when I use it at the same url it works. Are you using a PUT request ?

waal's picture
Joined: Nov 6 2012 - 2:22pm
Last seen: 8 years 9 months ago

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:\"\"}' "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
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

csaurav80 - 9 years 9 months ago

When I run the following curl command:
curl -i -u superuser:superuser -X PUT -H "Content-Type:text/xml" -H "Accept:text/xml" -d '<user><username>Fozzie</username><password>123</password><fullName>Fozzie Bear</fullName><tenantId>develdb</tenantId></user>' "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
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.

waal - 9 years 9 months ago

You need to set externallyDefined along with enabled. Also if role or user is in an org, that should be specified.



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..

  <fullName>John Doe</fullName>

bquinn's picture
Joined: Dec 19 2011 - 6:12am
Last seen: 9 years 6 months ago