Custom Roles (roles)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/domain/roles

Creating a new user role

GET

/rest/v1/domain/roles

Getting a list of user roles

GET

/rest/v1/domain/roles/<id>

Retrieving user role data

PATCH

/rest/v1/domain/roles/<id>

Changing user role data

DELETE

/rest/v1/domain/roles/<id>

Deleting a user role

LOOKUP

/rest/v1/domain/roles

Searching for the user role ID


Creating a new user role

Request

Field Description: role entity

Request example
POST /rest/v1/domain/roles HTTP/1.1
Content-Type: application/json; charset=utf-8

role entity

Response

Field Description: role entity

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "afafafaf-0178-3fc1-67fc-7cd30a921f58",
  "name": "testrole",
  "description": "",
  "parent_id": "00000000-0000-0000-0000-000000000000",
  "routes": [
    {
      "methods": [ "*" ],
      "url": "/rest/v1/model/abc/def"
    },
    {
      "methods": [ "GET", "LOOKUP" ],
      "url": "/rest/v1/model/abc/zzzzzzzzz"
    },
    {
      "methods": ["WEBSOCKET"],
      "url": "/ws#rest"
    }
  ],
  "webapps": [],
  "opts": {
    "comment": "",
    "title": ""
  },
  "ext": {
    "ct": "2021-03-20T10:37:03.82Z",
    "lwt": "2021-03-20T10:41:42.25Z"
  }
}

Getting a list of user roles

Request

Table 1. Request parameters
Name Type Description

filter

object

Filter by field values.

mask

str

List of fields to output. Available fields for output: id, name, description, parent_id, routes, opts.title, opts.comment, ext.lwt, ext.ct.

offset

int

Offset in the list of resources to be issued.

limit

int

The maximum number of resources in the list.

order

array<object|str>

The sort order of the resources in the list.

flat

bool

Conversion to flat form of composite fields.

Request example
GET /rest/v1/domain/roles?offset=0&limit=2 HTTP/1.1

Response

Field Description: role entity

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "id": "afafafaf-0178-3fc1-67fc-7cd30a921f58",
    "name": "testrole",
    "description": "",
    "parent_id": "00000000-0000-0000-0000-000000000000",
    "routes": [
      {
        "methods": [ "" ],
        "url": "/rest/v1/model/abc/def"
      },
      {
        "methods": [ "GET", "LOOKUP" ],
        "url": "/rest/v1/model/abc/zzzzzzzzz"
      },
      {
        "methods": ["WEBSOCKET"],
        "url": "/ws#rest"
      }
    ],
    "webapps": [],
    "opts": {
      "comment": "",
      "title": ""
    },
    "ext": {
      "ct": "2021-03-20T10:37:03.82Z",
      "lwt": "2021-03-20T10:41:42.25Z"
    }
  },
  {
    "id": "abcdef00-05b7-8163-948c-3392a9660db9",
    "name": "xxx",
    "description": "",
    "parent_id": "afafafaf-0178-3fc1-67fc-7cd30a921f58",
    "routes": [
      {
        "methods": [
          "GET"
        ],
        "url": "/rest/v1/uc/*"
      }
    ],
    "webapps": [],
    "opts": {
      "comment": "",
      "title": ""
    },
    "ext": {
      "ct": "2021-03-22T20:22:25.26Z",
      "lwt": "2021-03-22T20:22:25.26Z"
    }
  }
]

Retrieving user role data

Request

Table 2. Request parameters
Name Type Description

mask

str

A list of fields to output.

flat

bool

Conversion to flat form of composite fields.

Request example
GET /rest/v1/domain/roles/afafafaf-0178-3fc1-67fc-7cd30a921f58 HTTP/1.1

Response

Field Description: role entity

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "afafafaf-0178-3fc1-67fc-7cd30a921f58",
  "name": "testrole",
  "description": "",
  "parent_id": "00000000-0000-0000-0000-000000000000",
  "routes": [
    {
      "methods": [ "*" ],
      "url": "/rest/v1/model/abc/def"
    },
    {
      "methods": [ "GET", "LOOKUP" ],
      "url": "/rest/v1/model/abc/zzzzzzzzz"
    },
    {
      "methods": ["WEBSOCKET"],
      "url": "/ws#rest"
    }
  ],
  "webapps": [],
  "opts": {
    "comment": "",
    "title": ""
  },
  "ext": {
    "ct": "2021-03-20T10:37:03.82Z",
    "lwt": "2021-03-20T10:41:42.25Z"
  }
}

Changing user role data

Fields prohibited for modification: id

Request

Field Description: role entity

Request example
PATCH /rest/v1/domain/roles/afafafaf-0178-3fc1-67fc-7cd30a921f58 HTTP/1.1
Content-Type: application/json; charset=utf-8

role entity

Response

Field Description: role entity

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "afafafaf-0178-3fc1-67fc-7cd30a921f58",
  "name": "testrole",
  "description": "",
  "parent_id": "00000000-0000-0000-0000-000000000000",
  "routes": [
    {
      "methods": [ "*" ],
      "url": "/rest/v1/model/abc/def"
    },
    {
      "methods": [ "GET", "LOOKUP" ],
      "url": "/rest/v1/model/abc/zzzzzzzzz"
    },
    {
      "methods": ["WEBSOCKET"],
      "url": "/ws#rest"
    },
    {
      "methods": ["WEBSOCKET"],
      "url": "/ws#subscr"
    }
  ],
  "webapps": [],
  "opts": {
    "title": "",
    "comment": "New comment"
  },
  "ext": {
    "ct": "2021-03-20T10:37:03.82Z",
    "lwt": "2021-03-20T10:41:42.25Z"
  }
}

Deleting a user role

Request

Request example
DELETE /rest/v1/domain/roles/afafafaf-0178-3fc1-67fc-7cd30a921f58 HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

Searching for the user role ID

Searches the resource for the specified key, returns the identifier(s) to build the endpoint.

Key fields to search for: id, name

Request

Request example
LOOKUP /rest/v1/domain/roles HTTP/1.1
Content-Type: application/json; charset=utf-8

"testrole"

Response

Example of a successful response
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8

[
  "afafafaf-0178-3fc1-67fc-7cd30a921f58"
]
Example of an unsuccessful response
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8

{
  "error_code": 1404,
  "error_message": "Lookup failed"
}