Roles are templates for sets of permissions. Updating and deleting roles does not affect the permissions of users to which they were applied.
PUT /api/admin/v1/roles/{role}
int role, unique role identifier
int
string name, role name
string
array permissions, array of permission IDs, existing with the type specified in the 'type' parameter
array
200 OK
OK
Successful response
{ "id": 7, "name": "admin", "type": "admin", "type_pretty": "Administrator", "created_at": "2022-03-18 14:41:00", "updated_at": "2022-06-06 10:46:14", "permissions": [ { "id": 58, "name": "cameras-inactive", "display_name": "Viewing problem cameras", "group": "Cameras" }, { "id": 60, "name": "cameras-search", "display_name": "Camera search", "group": "Cameras" }, { "id": 66, "name": "cameras-destroy", "display_name": "Deleting a camera", "group": "Cameras" } ] }
401 Unauthorized
Unauthorized
Authorization token is not provided or is invalid. Obtaining a token
curl -k --request POST \ --url 'https://your-domain/api/admin/v1/roles/{role}' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --data '{ "role": 0, "name": "string", "permissions": [] }'
$data = array ( 'role' => 0, 'name' => 'string', 'permissions' => array ( ), ); $context = stream_context_create([ 'ssl'=>['verify_peer' => false], 'http' => [ 'method' => 'PUT', 'header' => "Content-Type: application/json\r Accept: application/json", 'content'=>json_encode($data) ] ]); $result = file_get_contents('https://your-domain/api/admin/v1/roles/{role}', false, $context);
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.