Skip to main content
Skip table of contents

Administrator role update

Administrator role update

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}

Method parameters

int role, unique role identifier


string name, role name


array permissions, array of permission IDs, existing with the type specified in the 'type' parameter

200 OK

Successful response

JSON
{
    "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

Authorization token is not provided or is invalid. Obtaining a token

cURL
BASH
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": []
}'
PHP
PHP
$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);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.