Assign Users to an Application Role or Granular Role (v2)
REST Resource
PUT /interop/rest/security/v2/role/assign/user
Table 2-18 Tasks for Assign Users to Roles
| Task | Request | REST Resource |
|---|---|---|
| Assign role | PUT | /interop/rest/security/v2/role/assign/user |
Request
Supported Media Types: application/json
Table 2-19 Parameters
| Name | Description | Type | Required | Default |
|---|---|---|---|---|
rolename |
The name of an application or granular role applicable to the service. An incorrect role name will result in an error.
|
Payload | Yes | None |
users |
List of user login IDs of the users whose role assignment is to be modified. | Payload | Yes | None |
Example URL and Payload
https://<BASE-URL>/interop/rest/security/v2/role/assign/user
{
"rolename": "Service Administrator",
"users": [
{
"userlogin": "jdoe"
},
{
"userlogin": "chris"
}
]
} Response
Supported Media Types: application/json
Table 2-20 Parameters
| Name | Description |
|---|---|
links |
Detailed information about the link and HTTP call type |
status |
Identifies the status of the operation
|
error |
Detailed information about the error |
details |
Detailed status of the operation performed. Total number of records processed, succeeded, and failed and reason for why it failed. |
Examples of Response Body
Example 1: Job Completes without Errors
{
"links": {
"href": "https://<BASE-URL>/interop/rest/security/v2/role/assign/user",
"action": "PUT"
},
"status": 0,
"error": null,
"details": {
"processed": 3,
"succeeded": 3,
"failed": 0,
"faileditems": null
}
} Example 2: Job Completes with Errors
{
"links": {
"href": "https://<BASE-URL>/interop/rest/security/v2/role/assign/user",
"action": "PUT"
},
"status": 1,
"error": {
"errorcode": "EPMCSS-21000",
"errormessage": "Failed to assign role. Invalid role name <rolename>. Please provide a valid role name."
},
"details": null
} Example 3: Job Completes with Partial Errors
{
"links": {
"href": "https://<BASE-URL>/interop/rest/security/v2/role/assign/user",
"action": "PUT"
},
"status": 0,
"error": null,
"details": {
"processed": 5,
"succeeded": 3,
"failed": 2,
"faileditems":
[
{
"userlogin": "jdoe",
"errorcode": "EPMCSS-21002",
"errormessage": "Failed to assign role. User jdoe does not exist. Provide a valid userlogin."
},
{
"userlogin": "chris",
"errorcode": "EPMCSS-21002",
"errormessage": "Failed to assign role. User chris does not exist. Provide a valid userlogin."
}
]
}
} Sample cURL Command Basic Auth Application Role
curl -X PUT -s -u '<USERNAME>:<PASSWORD>' -H 'Content-Type: application/json' -d '{"rolename":"Viewer","users":[{"userlogin":"jdoe1"},{"userlogin":"chris1"}]}' 'https://<BASE-URL>/interop/rest/security/v2/role/assign/user'
Sample cURL Command Basic Auth Granular Role
curl -X PUT -s -u '<USERNAME>:<PASSWORD>' -H 'Content-Type: application/json' -d '{"rolename":"Ad Hoc - Create","users":[{"userlogin":"jdoe1"},{"userlogin":"chris1"}]}' 'https://<BASE-URL>/interop/rest/security/v2/role/assign/user'
Sample cURL Command OAuth 2.0 Application Role
curl -X PUT --header "Authorization: Bearer <OAUTH_ACCESS_TOKEN>" -H 'Content-Type: application/json' -d '{"rolename":"Viewer","users":[{"userlogin":"jdoe1"},{"userlogin":"chris1"}]}' 'https://<BASE-URL>/interop/rest/security/v2/role/assign/user'
Sample cURL Command OAuth 2.0 Granular Role
curl -X PUT --header "Authorization: Bearer <OAUTH_ACCESS_TOKEN>" -H 'Content-Type: application/json' -d '{"rolename":"Ad Hoc - Create","users":[{"userlogin":"jdoe1"},{"userlogin":"chris1"}]}' 'https://<BASE-URL>/interop/rest/security/v2/role/assign/user'