Add roles to one or more users
post
/rest/users/roles
Adds one or more effective-dated roles to each supplied user and supports multiple users in the same request.
Request
Header Parameters
-
Password(required):
Application password.
-
PasswordType(required):
Password type (case-sensitive). Use PasswordText. PasswordDigest requires webservice.allowHashedPassword=Yes.
-
Username(required):
Application username.
Response
201 Response
Role assignments created.
Headers
-
Location:
Self URI for a single created role assignment; omitted for batch assignments.
400 Response
Invalid collection, missing field, duplicate role, or invalid effective dates.
401 Response
Authentication failed.
403 Response
Authorization failed for UserService/addRole.
404 Response
User or security group was not found.
409 Response
The user already has the requested role.
500 Response
Uncatalogued business or internal processing error.
Examples
This example describes how to add roles to one or more users.
Example cURL Command
Use the following cURL command to submit a request on the REST resource:
curl -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-u username:password \
"http://server:port/PASJava/rest/users/roles" \
-d '{"Use this placeholder to plug-in the example request body given below"}' Example Request Body in JSON Format
The following shows an example of the request body in JSON format:
{
"users": [
{
"userId": "{{user2}}",
"roles": [
{
"roleName": "{{roleThree}}",
"effectiveFrom": "{{effectiveFrom}}",
"effectiveTo": "{{effectiveTo}}"
}
]
},
{
"userId": "{{user3}}",
"roles": [
{
"roleName": "{{roleTwo}}",
"effectiveFrom": "{{effectiveFrom}}",
"effectiveTo": "{{effectiveTo}}"
}
]
}
]
}
Example Response Body in JSON Format
The following shows an example of the response body in JSON format:
{
"users": [
{
"userId": "REST_P2_AMARTIN_1787653277041",
"roles": [
{
"roleName": "Prototype Mask High Security",
"effectiveFrom": "2015-07-31T00:00:00Z",
"effectiveTo": "2036-11-18T00:00:00Z",
"self": "http://fsgbu-mum-143.snbomprshared1.gbudcsint02bom.oraclevcn.com:7001/PASJava/rest/users?userId=REST_P2_AMARTIN_1787653277041&role=Prototype+Mask+High+Security"
}
]
},
{
"userId": "REST_P2_RPATEL_1787653277041",
"roles": [
{
"roleName": "Prototype Analyst",
"effectiveFrom": "2015-07-31T00:00:00Z",
"effectiveTo": "2036-11-18T00:00:00Z",
"self": "http://fsgbu-mum-143.snbomprshared1.gbudcsint02bom.oraclevcn.com:7001/PASJava/rest/users?userId=REST_P2_RPATEL_1787653277041&role=Prototype+Analyst"
}
]
}
]
}
Example Request Body in XML Format
The following shows an example of the request body in XML format:
<users>
<user>
<userId>{{user2}}</userId>
<roles>
<role>
<roleName>{{roleThree}}</roleName>
<effectiveFrom>{{effectiveFrom}}</effectiveFrom>
<effectiveTo>{{effectiveTo}}</effectiveTo>
</role>
</roles>
</user>
<user>
<userId>{{user3}}</userId>
<roles>
<role>
<roleName>{{roleTwo}}</roleName>
<effectiveFrom>{{effectiveFrom}}</effectiveFrom>
<effectiveTo>{{effectiveTo}}</effectiveTo>
</role>
</roles>
</user>
</users>
Example Response Body in XML Format
The following shows an example of the response body in XML format:
<users>
<user>
<userId>REST_P2_AMARTIN_1787653277041</userId>
<roles>
<role>
<roleName>Prototype Mask High Security</roleName>
<effectiveFrom>2015-07-31T00:00:00Z</effectiveFrom>
<effectiveTo>2036-11-18T00:00:00Z</effectiveTo>
<self>http://fsgbu-mum-143.snbomprshared1.gbudcsint02bom.oraclevcn.com:7001/PASJava/rest/users?userId=REST_P2_AMARTIN_1787653277041&role=Prototype+Mask+High+Security</self>
</role>
</roles>
</user>
<user>
<userId>REST_P2_RPATEL_1787653277041</userId>
<roles>
<role>
<roleName>Prototype Analyst</roleName>
<effectiveFrom>2015-07-31T00:00:00Z</effectiveFrom>
<effectiveTo>2036-11-18T00:00:00Z</effectiveTo>
<self>http://fsgbu-mum-143.snbomprshared1.gbudcsint02bom.oraclevcn.com:7001/PASJava/rest/users?userId=REST_P2_RPATEL_1787653277041&role=Prototype+Analyst</self>
</role>
</roles>
</user>
</users>