Editing User Roles Using the API
This case covers using the WISEflow API to get, update, and remove user roles using the API. It does not cover how to find the userId which is described in this article.
This use case is ideal for institutions relying on the WISEflow API and has built their own middleware to control key aspects of WISEflow.
Get User Roles
With the userId as the parameter to identify the user, the GET /users/{userId}/roles endpoint will return all roles currently on the user:
{
"success": true,
"data": [
{
"userRoleId": 3721635,
"licenseRoleId": 2,
"name": "Assessor"
},
{
"userRoleId": 3721636,
"licenseRoleId": 3,
"name": "Manager"
}
],
"error": null
}
Using this data, you can identify the userRoleId, the licenseRoleId and the name of the role.
Update User Roles
With the POST /users/{userId}/roles you can set roles on a user. Using the userId to uniquely identify the user, the body takes the licenseRoleId of the role that should be added:
[
{
"licenseRoleId": 1
}
]
The licenseRoleIds can be fetched from the GET /license/info endpoint.
The endpoint will return the userRoleId, the licenseRoleId and the name of the user role:
{
"success": true,
"data": [
{
"userRoleId": 3721635,
"licenseRoleId": 2,
"name": "Assessor"
}
],
"error": null
}
Remove a Role From a User
{
"success": true,
"data": null,
"error": null
}