РRoles serve as templates for sets of permissions. Updating and deleting roles does not affect the permissions of users to whom they were applied.
POST /api/admin/v1/roles
string name, role name
string
string type, role type
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' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --data '{ "name": "string", "type": "string", "permissions": [] }'
$data = array ( 'name' => 'string', 'type' => 'string', 'permissions' => array ( ), ); $context = stream_context_create([ 'ssl'=>['verify_peer' => false], 'http' => [ 'method' => 'POST', 'header' => "Content-Type: application/json\r Accept: application/json", 'content'=>json_encode($data) ] ]); $result = file_get_contents('https://your-domain/api/admin/v1/roles', false, $context);
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.