Jump to content
We've recently updated our Privacy Statement, available here ×

Unable to create user using REST API in 5.5.0 (worked in 4.5.1)


spierepf

Recommended Posts

Greetings,

I am trying to use the REST API to create users. The following request used to work in jasperserver 4.5.1:

 

PUT /jasperserver-pro/rest/user HTTP/1.1Authorization: Basic c3VwZXJ1c2VyOnN1cGVydXNlcg==Transfer-Encoding: chunkedHost: localhost:8081Connection: Keep-AliveUser-Agent: Apache-HttpClient/4.2.1 (java 1.5)88  organization_1  username  password  0

and used to get me a 201-Created response:

HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Cache-Control: privateExpires: Wed, 31 Dec 1969 20:00:00 ASTSet-Cookie: JSESSIONID=A936AE3DD13F4A42F893F5592A81D26F; Path=/jasperserver-pro/; HttpOnlyContent-Type: text/xml;charset=UTF-8Content-Length: 0Date: Fri, 14 Feb 2014 18:59:56 GMT

However this request no longer works in 5.5.0 and just gets me:

 

HTTP/1.1 400 Bad RequestServer: Apache-Coyote/1.1Cache-Control: privateExpires: Wed, 31 Dec 1969 20:00:00 ASTP3P: CP="ALL"Set-Cookie: JSESSIONID=57E555D7C12FB5619B00A25B5828310A; Path=/jasperserver-pro/; HttpOnlyContent-Type: text/xml;charset=UTF-8Content-Length: 0Date: Fri, 14 Feb 2014 18:46:58 GMTConnection: close

Is anyone aware of any changes to the REST API between 4.5.1 and 5.5.0? Peter.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Starting with 5.0, I think you're suppose to be using rest_v2 interface. Example: To add user "hozawa"

PUT /jasperserver-pro/rest_v2/organizations/organization_1/users/hozawa?j_username=adminUsername&j_password=adminPassword

<user>
  <enabled>true</enabled>
  <externallyDefined>false</externallyDefined>
  <fullName>Hitoshi Ozawa</fullName>
  <emailAddress>hozawa@legendapl.com</emailAddress>
  <password>hozawa</password>
</user>

Link to comment
Share on other sites

Yes, I saw the rest_v2 api. But I cannot use it because then my code would depend on the server version. The documentation for the rest api in 5.1 http://community-static.jaspersoft.com/sites/default/files/docs/jasperreports-server-web-services-guide_1.pdf has a whole section (4.2 starting on p86) on the user service, so I don't think that the old api has gone away.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...