API v2: User-Role Assignment πŸ†•ΒΆ

Data StructuresΒΆ

UserRoleModelΒΆ

Attribute

Type

Required

Description

id

string

Read-only. Unique identifier. Protected.

user_id

string

yes

Immutable. Uniqueness is required in the combination of attribute user_id with attribute role_id. Requires read right on the user object for GET requests.

role_id

string

yes

Immutable. Uniqueness is required in the combination of attribute role_id with attribute user_id.

role_name

string

Read-only; Expensive to use.

user_name

string

Read-only; Expensive to use.

privs

string-array

yes

Read-only; 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.

Retrieve Available Attributes of the UserRoleModelΒΆ

Request

Method

GET

Path

/api/v2/objspec/user_role

GET /api/v2/objspec/user_role

Example Request

curl -s -k -X GET \
  -H 'Authorization: sgfeea6jsaz4mum9su8w6' \
  'https://10.0.214.98/api/v2/objspec/user_role'

Get User-Role Assignment ListΒΆ

Request

Method

GET

Path

/api/v2/user/role

GET /api/v2/user/role

Example Request

curl -s -k -X GET \
  -H 'Authorization: sgfeea6jsaz4mum9su8w6' \
  'https://10.0.214.98/api/v2/user/role'

Response

{
  "result": "success",
  "user_role": [
    {
      "user_id": "9115285645797883905",
      "role_id": "9115285645797883905",
      "role_name": "superadmin",
      "user_name": "admin",
      "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
    },
    {
      "user_id": "9115285645797883908",
      "role_id": "9115285645797883908",
      "role_name": "operator",
      "user_name": "remoteapp",
      "privs": [
        "user-session-view",
        "listener-read",
        "notification-filter-create",
        "notification-filter-read",
        "..."
      ],
      "created_at": "2025-05-07 05:17:40.584837-07",
      "modified_at": "2025-05-07 05:17:40.584837-07",
      "builtin": false,
      "hidden": false
    }
  ]
}

Get Role Assigned to a User by Their IDsΒΆ

Request

Method

GET

Path

/user/<user_id>/role/<role_id>

GET /api/v2/user/<user_id>/role/<role_id>

Example Request

curl -s -k -X GET \
  -H 'Authorization: sgfeea6jsaz4mum9su8w6' \
  'https://10.0.214.98/api/v2/user/9115285645797883905/role/9115285645797883905'

Response

{
    "result": "success",
    "user_role": {
        "user_id": "9115285645797883905",
        "role_id": "9115285645797883905",
        "role_name": "superadmin",
        "user_name": "admin",
        "privs": [
            "account-create",
            "account-read",
            "account-modify",
            "account-delete",
                        "..."
        ],
        "created_at": "2025-04-25 01:40:11.206421-07",
        "modified_at": "2025-04-25 01:40:11.206421-07",
        "builtin": false,
        "hidden": false
    }
}

Create User-Role AssignmentΒΆ

Request

Method

POST

Path

/api/v2/user/role

Headers

Content-Type: Application/json

Body

UserRoleModel

POST /api/v2/user/role

Example Request

curl -s -k -X POST \
  -H 'Authorization: sgfeea6jsaz4mum9su8w6' \
      -H 'Content-Type: application/json' \
  'https://10.0.214.98/api/v2/user/role' \
      -d'{"user_id":"9115285645797883905","role_id":"9115285645797883908"}'

Response

{
    "result": "success"
}

Delete User-Role AssignmentΒΆ

Request

Method

DELETE

Path

/api/v2/user/<user_id>/role/<role_id>

DELETE /api/v2/user/<user_id>/role/<role_id>

Example Request

curl -s -k -X DELETE \
  -H 'Authorization: sgfeea6jsaz4mum9su8w6' \
  'https://10.31.87.227/api/v2/user/9115285645797883905/role/9115285645797883908'

Response

{
    "result": "success"
}