Skip to content

Update role

Request to update an existing role:

PUT /api/v2/roles/<role-id>.json

The request body contains the attributes of the role object to change. Attributes that are not included keep their values. When permissions is included, it replaces the whole permissions dictionary: resources that are not listed lose their permissions.

For example:

{
    "role": {
        "name": "Supervisor",
        "permissions": {
            "rest_api": ["allow"],
            "users": ["view"],
            "calls": ["view", "playback", "categorize", "on_demand_trigger"]
        }
    }
}

Response contains HTTP status code as shown in the following table.

Response Description
200 OK The role has been successfully updated. The response body contains the complete role object after the update
400 Bad Request

The request cannot be completed because the supplied JSON object has invalid data.

The response contains a detailed description of the error, like:

{"error": "InvalidRecord", "explanation": "Record Validation errors", "details": {"name": "Role with such name exists already"}}
403 Forbidden The request cannot be completed because API user has no permission to edit roles
404 Not Found Role with such ID does not exist, or it is outside the access scope of the API user