Updating roles on a single user can be a common task in the Risk Cloud, and with Risk Cloud’s User API, you can achieve that as well.
Prerequisites
- Obtain your API Access Token or pull the Risk Cloud Postman Collection to get started.
- Required user role:
Admin
for the PUT endpoint at least - You will NOT be able to update users who are auto-provisioned. This will have to be managed thru your IDP.
1. Get User
Retrieve the user that you want to update via this endpoint.
This endpoint has the following parameters:
Required Path Parameter | Required | Description |
---|---|---|
userId | Yes | The User ID you want to update. |
2. Update User Details
Update the individual user details via this endpoint. Add the updated user data in to the body request, for example, change the user email address, timeZone, first, or last name with this endpoint.
Request
This endpoint has the following request body properties:
// Add additional user information in the ... section
{
"email": "[email protected]",
"status": <string: status ex Active>,
"first": "test",
"last": "user",
"name": "test user",
...
}
Response
This endpoint will return the updated User
object. Re-run step 1 to verify the changes (please allow a few seconds to update our cache state).
3. Update User Roles
Update the user via this endpoint. Specify the userId
. Add the user data in to the body request. Update the user data "Role"
field to add and/or remove role(s) that you want.
This endpoint has the following parameters:
Required Path Parameter | Required | Description |
---|---|---|
userId | Yes | The User ID you want to update. |
Request
This endpoint has the following request body properties:
//Everything will be copied over from the GET User Response
//All you would need to do to add / remove roles from the "roles" list
{
"status": <string: status ex Active>,
...
"roles": [
{
"id":<string: roleId that already exist and I am keeping it - this would be left alone>
},
{
"id":<string: roleId I want to add - this would be added>
}
//{
// "id":<string: roleId that already exist and I want to remove - this would be deleted>
//}
],
...
"transientIdOrId": <string: transientIdorId>
}
Response
This endpoint will return the updated User
object. Re-run step 1 to verify the changes (please allow a few seconds to update our cache state).