API v2: Roles πΒΆ
Data StructuresΒΆ
Attribute | Type | Required | Description |
---|---|---|---|
id |
string | Read-only. Unique identifier. | |
name |
string | yes | Case-insensitive. Unique. |
description |
string | ||
privs |
string-array | yes | Read-write; Expensive to use. |
created_at |
datetime | Read-only. Timestamp of creation. | |
modified_at |
datetime | Read-only. Timestamp of modification. | |
removed |
boolean | Read-only. | |
builtin |
boolean | Read-only; Expensive to use; If true , the object is not editable. |
|
hidden |
boolean | Read-only; Expensive to use; If true , the object is hidden in UI. |
Request for Retrieving Available Attributes of the RoleModelΒΆ
Request
Method | GET |
Path | /api/v2/objspec/role |
GET /api/v2/objspec/role
Example Request
curl -s -k -X GET \
-H 'Authorization: sgfeea6jsaz4mum9su8w6' \
'https://10.0.214.98/api/v2/objspec/role'
Get Roles ListΒΆ
Request
Method | GET |
Path | /api/v2/role |
GET /api/v2/role
Example Request
curl -s -k -X GET \
-H 'Authorization: sgfeea6jsaz4mum9su8w6' \
'https://10.0.214.98/api/v2/role'
Response
{
"result": "success",
"role": [
{
"id": "9115285645797883905",
"name": "superadmin",
"privs": [
"account-create",
"account-read",
"account-modify",
"..."
],
"created_at": "2025-04-25 01:40:11.204397-07",
"modified_at": "2025-04-25 01:40:11.204397-07",
"builtin": false,
"hidden": false
},
{
"id": "9115285645797883910",
"name": "viewer",
"privs": [
"user-session-view",
"dashboard"
],
"created_at": "2025-04-25 01:40:11.20449-07",
"modified_at": "2025-04-25 01:40:11.20449-07",
"builtin": false,
"hidden": false
}
]
}
Get Role by IDΒΆ
Request
Method | GET |
Path | /api/v2/role/<id> |
GET /api/v2/role/<id>
Example Request
curl -s -k -X GET \
-H 'Authorization: sgfeea6jsaz4mum9su8w6' \
'https://10.0.214.98/api/v2/role/9115285645797883910'
Response
{
"result": "success",
"role": {
"id": "9115285645797883910",
"name": "viewer",
"privs": [
"user-session-view",
"dashboard"
],
"created_at": "2025-04-25 01:40:11.20449-07",
"modified_at": "2025-04-25 01:40:11.20449-07",
"builtin": false,
"hidden": false
}
}
Create RoleΒΆ
Request
Method | POST |
Path | /api/v2/role |
Headers | Content-Type: Application/json |
Body | RoleModel |
POST /api/v2/role
Example Request
curl -s -k -X POST \
-H 'Authorization: sgfeea6jsaz4mum9su8w6' \
-H 'Content-Type: application/json' \
'https://10.0.214.98/api/v2/role' \
-d'{"name": "Role_Session_Viewer","privs": ["user-session-view","dashboard"]}'
Response
{
"result": "success",
"role": {
"id": "9115285645797883911"
}
}
Modify RoleΒΆ
Request
Method | PATCH |
Path | /api/v2/role/<id> |
Headers | Content-Type: Application/json |
Body | RoleModel |
PATCH /api/v2/role/<id>
Example Request
curl -s -k -X PATCH \
-H 'Authorization: sgfeea6jsaz4mum9su8w6' \
-H 'Content-Type: application/json' \
'https://10.31.87.227/api/v2/role/9115285645797883911' \
-d'{"name": "Role_Session_Manager","privs": ["session-read","session-modify","session-delete","session-encode","session-file-read","session-file-download","session-file-delete","session-movie-read","session-movie-download","session-share-view","session-share-join","session-comment-read","session-comment-write","session-terminate","session-export"]}'
Response
{
"result": "success"
}
Grant Privileges to RoleΒΆ
Request
Method | PATCH |
Path | /api/v2/role/<id>/grant |
Headers | Content-Type: Application/json |
Body | RoleModel |
PATCH /api/v2/role/<id>/grant
Example Request
curl -s -k -X PATCH \
-H 'Authorization: proxycrypto' \
-H 'Content-Type: application/json' \
'https://10.31.87.227/api/v2/role/9115285645797883912/grant' \
-d'{"privs": ["session-read","session-modify"]}'
Response
{
"result": "success"
}
Revoke Privileges from RoleΒΆ
Request
Method | PATCH |
Path | /api/v2/role/<id>/revoke |
Headers | Content-Type: Application/json |
Body | RoleModel |
PATCH /api/v2/role/<id>/revoke
Example Request
curl -s -k -X PATCH \
-H 'Authorization: proxycrypto' \
-H 'Content-Type: application/json' \
'https://10.31.87.227/api/v2/role/9115285645797883912/revoke' \
-d'{"privs": ["session-read","session-modify"]}'
Response
{
"result": "success"
}
Delete RoleΒΆ
Request
Method | DELETE |
Path | /api/v2/role/<id> |
DELETE /api/v2/role/<id>
Example Request
curl -s -k -X DELETE \
-H 'Authorization: sgfeea6jsaz4mum9su8w6' \
'https://10.31.87.227/api/v2/role/9115285645797883911'
Response
{
"result": "success"
}