spierepf Posted February 14, 2014 Share Posted February 14, 2014 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 0and 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 GMTHowever 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: closeIs 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 More sharing options...
spierepf Posted February 14, 2014 Author Share Posted February 14, 2014 Somewhere, the post editor on this site changed part of my request from <fullName/> to <fullName></fullName>. Weird! Link to comment Share on other sites More sharing options...
hozawa Posted February 17, 2014 Share Posted February 17, 2014 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 More sharing options...
spierepf Posted February 17, 2014 Author Share Posted February 17, 2014 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 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