Skip to main content
Skip table of contents

Список ролей администратора

Получение списка ролей администратора

GET /api/admin/v1/roles

Параметры метода

int per_page, количество элементов в одной странице пагинации. По умолчанию 25 штук


string type, тип роли


int exclude, массив id ролей, которые надо исключить


bool permissions, включить в объект роли пермишены


int page, номер страницы пагинации

200 OK

Успешный ответ

JSON
{
    "data": [
        {
            "id": 7,
            "name": "admin",
            "type": "admin",
            "type_pretty": "Администратор",
            "created_at": "2022-03-18 14:41:00",
            "updated_at": "2022-03-18 14:41:00"
        },
        {
            "id": 6,
            "name": "admin",
            "type": "admin",
            "type_pretty": "Администратор",
            "created_at": "2021-12-15 19:45:12",
            "updated_at": "2021-12-15 19:45:12"
        },
        {
            "id": 5,
            "name": "admin",
            "type": "admin",
            "type_pretty": "Администратор",
            "created_at": "2021-10-27 21:01:19",
            "updated_at": "2021-10-27 21:01:19"
        },
        {
            "id": 4,
            "name": "admin",
            "type": "admin",
            "type_pretty": "Администратор",
            "created_at": "2021-06-03 19:29:23",
            "updated_at": "2021-06-03 19:29:23"
        },
        {
            "id": 2,
            "name": "admin",
            "type": "admin",
            "type_pretty": "Администратор",
            "created_at": "2021-06-02 17:51:34",
            "updated_at": "2021-06-02 18:53:42"
        },
        {
            "id": 1,
            "name": "admin",
            "type": "admin",
            "type_pretty": "Администратор",
            "created_at": "2021-06-02 17:41:21",
            "updated_at": "2021-06-02 17:41:21"
        }
    ],
    "links": {
        "first": "https://vms.local/api/admin/v1/roles?type=admin&page=1",
        "last": "https://vms.local/api/admin/v1/roles?type=admin&page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "links": [
            {
                "url": null,
                "label": "pagination.previous",
                "active": false
            },
            {
                "url": "https://vms.local/api/admin/v1/roles?type=admin&page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "pagination.next",
                "active": false
            }
        ],
        "path": "https://vms.local/api/admin/v1/roles",
        "per_page": 25,
        "to": 6,
        "total": 6
    }
}

401 Unauthorized

Токен авторизации не передан или не валидный Получение токена

cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/admin/v1/roles' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "per_page": 0,
    "type": "string",
    "exclude": 0,
    "permissions": true,
    "page": 0
}'
PHP
PHP
$data = array (
  'per_page' => 0,
  'type' => 'string',
  'exclude' => 0,
  'permissions' => true,
  'page' => 0,
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'GET',
		'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);
JavaScript errors detected

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

If this problem persists, please contact our support.