I am not sure what is going worng with the create user api with roles.
Observations:
1. When fired without the roles it works fine, the payload is given below
{
"fullName": "unittestuser",
"emailAddress": null,
"enabled": true,
"password": "39HN=K?E",
"roles": null
}
2. when same endpoint is invoked with the addition of roles then it fails giving the http error code 400 (bad request)
{
"fullName": "unittestuser",
"emailAddress": null,
"enabled": true,
"password": "39HN=K?E",
"roles": [
{ "name": "unittest" },
{ "name": "UsernamePasswordAuthentication" },
{ "name": "Platform_NamedUser" },
{ "name": "Platform_Anyone" },
{ "name": "Platform_Metadata_MetadataInitializeUser" }
]
}
3. The roles part works when the default roles shipped with Jaspersoft server installation are sent.
{
"fullName": "unittestuser3",
"emailAddress": null,
"externallyDefined": false,
"enabled": true,
"password": "39HN=K?E",
"roles": [
{ "name": "ROLE_USER" },
{ "name": "ROLE_ADMINISTRATOR" }
]
}
I have checked the the new roles which I have created are present on the Jasperserver before the create user is hit, so I am not sure what is going wrong with the newly created roles. I am using REST api v2 for role creation as well as user creation.
Let me know if anyone has a clue.
1 Answer:
Had the same problem. I think it was that JasperReports Server wants the user created first and then roles assigned (using PUT).
http://community.jaspersoft.com/documentation/tibco-jasperreports-server...
@hozawa - I got the same error even after trying insert and then update. Basically the request does not have any difference in create and update, both are http 'put'.