Введение

Документация предоставляет всю информацию, необходимую вам для работы с нашим API.

Аутентификация запросов

Для аутентификации запросов передайте Authorization заголовок со значением "Bearer {YOUR_AUTH_KEY}".

Все аутентифицированные конечные точки помечены как requires authentication в документации ниже.

Вы можете получить токен, выполнив аутентификацию:
Для обычных методов: api/v1/auth/login.
Для API клиентов (api/v1/client/*): api/v1/client/login.

User API

Взаимодействие от имени пользователя

Auth


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

POST
https://id.stage.odinn.cloud
/api/v1/auth/login

access_token является JWT. Пример payload:

{
 "aud": "9e196de3-9324-47c8-9bca-27b633af08c1",
 "jti": "219e04228fab177899a53e9ce294b77809b12f9306c4c9794ad8a7602b888bbcc233c4ee9661dafe",
 "iat": 1739180144.815972, // issued at time
 "nbf": 1739180144.815974,
 "exp": 1740389744.806619, // expire time
 "sub": "00000000-0000-4000-8001-000000000002", // user_id
 "scopes": []
}

Headers

Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
curl --request POST \
    "https://id.stage.odinn.cloud/api/v1/auth/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"username\": \"tempore\",
    \"password\": \"tq=mFxZO,\"
}"
Example response:

Обновление токена

POST
https://id.stage.odinn.cloud
/api/v1/auth/refresh

Headers

Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
curl --request POST \
    "https://id.stage.odinn.cloud/api/v1/auth/refresh" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"refresh_token\": \"ut\"
}"
Example response:
{
    "token_type": "Bearer",
    "expires_in": 120960,
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI5ZTE5NmRlMy05MzI0LTQ3YzgtOWJjYS0yN2I2MzNhZjA4YzEiLCJqdGkiOiI3MjAxNDMxZDEzZmMxNGRhYjA0NjY2NjI2NDgxZTA0MzVkOTA3ZDg1OTA5Nzk0MTBlYTA5N2VkYWFlNTg4M2E5YmU1YjRiYjU4MTI5NDU2OSIsImlhdCI6MTczOTE4MDU0Mi4zNDg3LCJuYmYiOjE3MzkxODA1NDIuMzQ4NzAyLCJleHAiOjE3NDAzOTAxNDIuMzQxNjAzLCJzdWIiOiIwMDAwMDAwMC0wMDAwLTQwMDAtODAwMS0wMDAwMDAwMDAwMDIiLCJzY29wZXMiOltdfQ.u7mqxZI343AWM1iEZwJ-i7PMsdUKT162z6HurihK_4nPAusQa14JmAnZg9_k2MukvyYf9xjdZPKM37MyvXEcFpJUlq61JQ-pB8D955dDJ7XEkeWuEnPODnhZYS56X-Xxa6Ut1E-7r-D5J2VX5TLi59Zs8ZWJ96kvsDysU21O93Wo0jht7KoJ-M33mZYZgvbyVXcnc1MS8JEGGXQaSAMe9z9XqPWYGLT3PDM-9mvdBRJBaBC2m__bYl01MF-IySznP4e13pAm7yDhuCpNkvg9Z30G7D0fPYZCF08oZ9sXJvFKzV_6fyz4IpIsteTmNuQ1g1cDAVHGg0upMMTulKBPap0a2IdHT8UGLig6MXxAka4ECUCV7ILXAq1IBXNrnWQ0k1YqwPPmsSoGYu80m9l2VJd6NmDMkVMeqdllvlIYh2diRe6tRkcvH0yGbwl2OAnDedAHMIYJwWbhXsxjB_Pd1_dSb1mR29lOCWtbN2TVksProHxTbhGv2qjNv3N1UgO8XuyC2N1HHjiq1L6ijpoFT58BK-yh_C5JfCpCzXb-c8n5HZnUln_Nhmn-MxT_CZ3KAmeHdiHlaINhacUj6_JimCE0EOGC0c8XuW_OxvF9MOiLPcKkPC6_Y8DE0q0Fzy1ik42ZGcFiSGaRKSqY6jETfj-WphZonBNgx3IBcUUW54Y",
    "refresh_token": "def50200a554a490c59e09811dc700f8f34bc52236c9b316e503fe89c2294c8395912517654fad3600c8ae4850e52f649600846a9d887163f0c5b5df93d1379dc0fbd4dd0636a3b83dfb9a2b897c06bc0a882f67837e3d425d272ef8e4c32f68e53ab39ba503802b05b0e37a6cf084200213c02faa559ecc03316d09777658bd69919dcb8e5a332a8e0e94ddd4b26673d5d11c2ac5871c9d618667299129ed9dbbec8621b5eca62e40a7e5ec5029094d68b53094bed74c9c3977577be4d147059a110a27b0e22d580e677897ce1131d8cae2353c7dad9694bcd77daf62db3ad378632870d2363ffc6d3001590cb190b9a157a7d960a28791055f3f7d4276228985c8cad79820ab0afa6eb1632d8555303d22f2a4a89d50a0dbc18f682de5ace934560a2d271a1b97d9ef40fd74dd84cba686e3bbb31d943fe93fc41847059942ef9d5b685e458b0e936557aceb8c1f46a18f10f6837413cba6fddc89572e7ec0ceccfe5f3a97f3d7a5c7ba66ebf64371c4b222dbb4e63191e9388fc497681ce071fc2bb156ac9bbad29b99e9628cb07139059d411e7b69c1b111e6629cfab9a25b0633ac44bd030c62"
}

Проверка авторизации пользователя

GET
https://id.stage.odinn.cloud
/api/v1/check-auth
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/check-auth" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "data": true
}

Users


Создать пользователя

POST
https://id.stage.odinn.cloud
/api/v1/users
requires authentication

Требуемые разрешения: users:create

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
curl --request POST \
    "https://id.stage.odinn.cloud/api/v1/users" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"tgtpfcz\",
    \"username\": \"fzpmaqkinyhaxolhemgidxhns\",
    \"password\": \"3\\\"T$spv{uEzK\\/QRtR[\",
    \"phone\": \"1494540366\",
    \"email\": \"ilene08@example.net\",
    \"roles\": [
        \"aliquam\"
    ]
}"
Example response:
{
    "id": "00000000-0000-4000-8001-000000000006",
    "name": "Test Executor 3",
    "username": "executor3",
    "email": "almaximal+executor3@ya.ru",
    "phone": null,
    "email_verified_at": null,
    "deleted_at": null,
    "created_at": "2025-02-06T10:34:15.000000Z",
    "updated_at": "2025-02-06T10:34:15.000000Z",
    "roles": [
        {
            "id": "9e257a75-1c86-468e-b95c-c4b557cbf440",
            "code": "executor",
            "name": "Исполнитель",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": "2025-02-06T10:34:14.000000Z"
        }
    ]
}
{
    "message": "User does not have any of permissions: users:create"
}

Получить информацию по нескольким пользователям

POST
https://id.stage.odinn.cloud
/api/v1/users/bulk-read
requires authentication

Требуемые разрешения: users:list

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
curl --request POST \
    "https://id.stage.odinn.cloud/api/v1/users/bulk-read" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"ids\": [
        \"4310bbb5-1ccf-3612-a1c2-21c39f1e8a14\"
    ]
}"
Example response:
[
    {
        "id": "00000000-0000-4000-8001-000000000011",
        "name": "Test Admin 2",
        "username": "admintest2",
        "email": "almaximal+admin2@ya.ru",
        "phone": null,
        "email_verified_at": null,
        "deleted_at": null,
        "created_at": "2025-02-06T10:34:15.000000Z",
        "updated_at": "2025-02-06T10:34:15.000000Z",
        "roles": [
            {
                "id": "9e257a75-2de3-4607-99db-91cf7c73850f",
                "code": "admin",
                "name": "Админ",
                "params": null,
                "notes": null,
                "author_id": null,
                "created_at": "2025-02-06T10:34:14.000000Z",
                "updated_at": "2025-02-06T10:34:14.000000Z"
            }
        ]
    },
    {
        "id": "00000000-0000-4000-8001-000000000002",
        "name": "Test Admin",
        "username": "admin",
        "email": "almaximal+admin@ya.ru",
        "phone": null,
        "email_verified_at": null,
        "deleted_at": null,
        "created_at": "2025-02-06T10:34:15.000000Z",
        "updated_at": "2025-02-06T10:34:15.000000Z",
        "roles": [
            {
                "id": "9e257a75-2de3-4607-99db-91cf7c73850f",
                "code": "admin",
                "name": "Админ",
                "params": null,
                "notes": null,
                "author_id": null,
                "created_at": "2025-02-06T10:34:14.000000Z",
                "updated_at": "2025-02-06T10:34:14.000000Z"
            }
        ]
    }
]
{
    "message": "User does not have any of permissions: users:list"
}

Получить список пользователей

GET
https://id.stage.odinn.cloud
/api/v1/users
requires authentication

Требуемые разрешения: users:list

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

role
string

Код роли, в которой искать пользователя (код полностью).

name
string

Отфильтровать имя или юзернейм (подстрока).

permission
string

Отфильтровать по доступу (user:auth, roles:list).

page
integer

Номер страницы.

Example:
1
page-size
integer

Количество элементов, возвращаемых на странице. По умолчанию 50.

Example:
50
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/users?page=1&page-size=50" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "current_page": 1,
    "data": [
        {
            "id": "00000000-0000-4000-8001-000000000002",
            "name": "Test Admin",
            "username": "admin",
            "email": "almaximal+admin@ya.ru",
            "phone": null,
            "email_verified_at": null,
            "deleted_at": null,
            "created_at": "2025-02-06T10:34:15.000000Z",
            "updated_at": "2025-02-06T10:34:15.000000Z",
            "roles": [
                {
                    "id": "9e257a75-2de3-4607-99db-91cf7c73850f",
                    "code": "admin",
                    "name": "Админ",
                    "params": null,
                    "notes": null,
                    "author_id": null,
                    "created_at": "2025-02-06T10:34:14.000000Z",
                    "updated_at": "2025-02-06T10:34:14.000000Z"
                }
            ]
        },
        {
            "id": "00000000-0000-4000-8001-000000000003",
            "name": "Test Employee",
            "username": "employee",
            "email": "almaximal+employee@ya.ru",
            "phone": null,
            "email_verified_at": null,
            "deleted_at": null,
            "created_at": "2025-02-06T10:34:15.000000Z",
            "updated_at": "2025-02-06T10:34:15.000000Z",
            "roles": [
                {
                    "id": "9e257a75-2853-40be-9934-9de8f10d524f",
                    "code": "master",
                    "name": "Мастер",
                    "params": null,
                    "notes": null,
                    "author_id": null,
                    "created_at": "2025-02-06T10:34:14.000000Z",
                    "updated_at": "2025-02-06T10:34:14.000000Z"
                }
            ]
        },
        {
            "id": "00000000-0000-4000-8001-000000000004",
            "name": "Test Executor 1",
            "username": "executor1",
            "email": "almaximal+executor1@ya.ru",
            "phone": null,
            "email_verified_at": null,
            "deleted_at": null,
            "created_at": "2025-02-06T10:34:15.000000Z",
            "updated_at": "2025-02-06T10:34:15.000000Z",
            "roles": [
                {
                    "id": "9e257a75-1c86-468e-b95c-c4b557cbf440",
                    "code": "executor",
                    "name": "Исполнитель",
                    "params": null,
                    "notes": null,
                    "author_id": null,
                    "created_at": "2025-02-06T10:34:14.000000Z",
                    "updated_at": "2025-02-06T10:34:14.000000Z"
                }
            ]
        }
    ],
    "first_page_url": "http://app_users:8080/api/v1/users?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "http://app_users:8080/api/v1/users?page=1",
    "links": [
        {
            "url": null,
            "label": "« Назад",
            "active": false
        },
        {
            "url": "http://app_users:8080/api/v1/users?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "Вперёд »",
            "active": false
        }
    ],
    "next_page_url": null,
    "path": "http://app_users:8080/api/v1/users",
    "per_page": 50,
    "prev_page_url": null,
    "to": 3,
    "total": 3
}
{
    "message": "User does not have any of permissions: users:list"
}

Получить текущего пользователя

GET
https://id.stage.odinn.cloud
/api/v1/users/current
requires authentication

Получить данные о текущем пользователе

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/users/current" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "id": "00000000-0000-4000-8001-000000000006",
    "name": "Test Executor 3",
    "username": "executor3",
    "email": "almaximal+executor3@ya.ru",
    "phone": null,
    "email_verified_at": null,
    "deleted_at": null,
    "created_at": "2025-02-06T10:34:15.000000Z",
    "updated_at": "2025-02-06T10:34:15.000000Z",
    "roles": [
        {
            "id": "9e257a75-1c86-468e-b95c-c4b557cbf440",
            "code": "executor",
            "name": "Исполнитель",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": "2025-02-06T10:34:14.000000Z"
        }
    ]
}

Получить разрешения текущего пользователя

GET
https://id.stage.odinn.cloud
/api/v1/users/current/permissions
requires authentication

Получить разрешения пользователя в виде массива кодов

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/users/current/permissions" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
[
    "roles:list",
    "roles:create",
    "roles:update",
    "roles:delete",
    "roles:assign"
]

Информация о пользователе

GET
https://id.stage.odinn.cloud
/api/v1/users/{id}
requires authentication

Требуемые разрешения: users:get

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
ca40ffe7-bbaa-3f3a-8f6f-25f25ebcdfb3
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/users/ca40ffe7-bbaa-3f3a-8f6f-25f25ebcdfb3" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
[
    {
        "id": "00000000-0000-4000-8001-000000000006",
        "name": "Test Executor 3",
        "username": "executor3",
        "email": "almaximal+executor3@ya.ru",
        "phone": null,
        "email_verified_at": null,
        "deleted_at": null,
        "created_at": "2025-02-06T10:34:15.000000Z",
        "updated_at": "2025-02-06T10:34:15.000000Z",
        "roles": [
            {
                "id": "9e257a75-1c86-468e-b95c-c4b557cbf440",
                "code": "executor",
                "name": "Исполнитель",
                "params": null,
                "notes": null,
                "author_id": null,
                "created_at": "2025-02-06T10:34:14.000000Z",
                "updated_at": "2025-02-06T10:34:14.000000Z"
            }
        ]
    }
]
{
    "message": "User does not have any of permissions: users:get"
}
{
    "message": "User not found: #00000000-0000-4000-8001-000000000009"
}

Обновить пользователя

PUT
https://id.stage.odinn.cloud
/api/v1/users/{id}
requires authentication

Требуемые разрешения: users:update

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
5c3eb033-697b-3b97-aaaf-7003c7f68ec4

Body Parameters

Example request:
curl --request PUT \
    "https://id.stage.odinn.cloud/api/v1/users/5c3eb033-697b-3b97-aaaf-7003c7f68ec4" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"xtykqghvbnvsbeais\",
    \"username\": \"egmmjdsxfjjvljl\",
    \"password\": \"2,@Q|:\",
    \"phone\": \"8653199207\",
    \"email\": \"hipolito.rolfson@example.net\",
    \"roles\": [
        \"quia\"
    ]
}"
Example response:
{
    "id": "00000000-0000-4000-8001-000000000006",
    "name": "Test Executor 3",
    "username": "executor3",
    "email": "almaximal+executor3@ya.ru",
    "phone": null,
    "email_verified_at": null,
    "deleted_at": null,
    "created_at": "2025-02-06T10:34:15.000000Z",
    "updated_at": "2025-02-06T10:34:15.000000Z",
    "roles": [
        {
            "id": "9e257a75-1c86-468e-b95c-c4b557cbf440",
            "code": "executor",
            "name": "Исполнитель",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": "2025-02-06T10:34:14.000000Z"
        }
    ]
}
{
    "message": "User does not have any of permissions: users:update"
}
{
    "message": "User not found: #00000000-0000-4000-8001-000000000009"
}

Назначить роли

PUT
https://id.stage.odinn.cloud
/api/v1/users/{id}/roles
requires authentication

Требуемые разрешения: users:update

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
6add1290-64ff-3ab7-8a1e-0310171b19ca

Body Parameters

Example request:
curl --request PUT \
    "https://id.stage.odinn.cloud/api/v1/users/6add1290-64ff-3ab7-8a1e-0310171b19ca/roles" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"roles\": [
        \"mjgsjret\"
    ]
}"
Example response:
{
    "id": "00000000-0000-4000-8001-000000000006",
    "name": "Test Executor 3",
    "username": "executor3",
    "email": "almaximal+executor3@ya.ru",
    "phone": null,
    "email_verified_at": null,
    "deleted_at": null,
    "created_at": "2025-02-06T10:34:15.000000Z",
    "updated_at": "2025-02-06T10:34:15.000000Z",
    "roles": [
        {
            "id": "9e257a75-1c86-468e-b95c-c4b557cbf440",
            "code": "executor",
            "name": "Исполнитель",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": "2025-02-06T10:34:14.000000Z"
        }
    ]
}
{
    "message": "User does not have any of permissions: users:update"
}
{
    "message": "User not found: #00000000-0000-4000-8001-000000000009"
}

Roles


Получить список всех ролей

GET
https://id.stage.odinn.cloud
/api/v1/roles
requires authentication

Требуемые разрешения: roles:list

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Номер страницы.

Example:
1
page-size
integer

Количество элементов, возвращаемых на странице. По умолчанию 50.

Example:
50
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/roles?page=1&page-size=50" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "current_page": 1,
    "data": [
        {
            "id": "9e257a75-2853-40be-9934-9de8f10d524f",
            "code": "master",
            "name": "Мастер",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": "2025-02-06T10:34:14.000000Z"
        },
        {
            "id": "9e257a75-2de3-4607-99db-91cf7c73850f",
            "code": "admin",
            "name": "Админ",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": "2025-02-06T10:34:14.000000Z"
        }
    ],
    "first_page_url": "http://app_users:8080/api/v1/roles?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "http://app_users:8080/api/v1/roles?page=1",
    "links": [
        {
            "url": null,
            "label": "« Назад",
            "active": false
        },
        {
            "url": "http://app_users:8080/api/v1/roles?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "Вперёд »",
            "active": false
        }
    ],
    "next_page_url": null,
    "path": "http://app_users:8080/api/v1/roles",
    "per_page": 50,
    "prev_page_url": null,
    "to": 2,
    "total": 2
}
{
    "message": "User does not have any of permissions: roles:list"
}

Создать роль

POST
https://id.stage.odinn.cloud
/api/v1/roles
requires authentication

Требуемые разрешения: roles:create

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
curl --request POST \
    "https://id.stage.odinn.cloud/api/v1/roles" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"code\": \"pypldtwcyvpqx\",
    \"name\": \"sebyhq\",
    \"notes\": \"igxfjbgdueggyyylcrkzqiu\",
    \"permissions\": [
        \"clrxsknzqiagb\"
    ]
}"
Example response:
{
    "id": "9e257a75-2853-40be-9934-9de8f10d524f",
    "code": "master",
    "name": "Мастер",
    "params": null,
    "notes": null,
    "author_id": null,
    "created_at": "2025-02-06T10:34:14.000000Z",
    "updated_at": "2025-02-06T10:34:14.000000Z",
    "permissions": [
        {
            "id": "00000000-0000-0000-0004-000000000001",
            "code": "users:list",
            "verb": "просматривать всех пользователей",
            "title": "Просмотр всех пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        },
        {
            "id": "00000000-0000-0000-0004-000000000002",
            "code": "users:create",
            "verb": "создавать пользователей",
            "title": "Создание пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        }
    ]
}
{
    "message": "User does not have any of permissions: roles:create"
}

Получить информацию о роли

GET
https://id.stage.odinn.cloud
/api/v1/roles/{id}
requires authentication

Требуемые разрешения: roles:list

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
05ec63e3-d72b-3710-a1e8-21c1c98856b0
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/roles/05ec63e3-d72b-3710-a1e8-21c1c98856b0" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "id": "9e257a75-2853-40be-9934-9de8f10d524f",
    "code": "master",
    "name": "Мастер",
    "params": null,
    "notes": null,
    "author_id": null,
    "created_at": "2025-02-06T10:34:14.000000Z",
    "updated_at": "2025-02-06T10:34:14.000000Z",
    "permissions": [
        {
            "id": "00000000-0000-0000-0004-000000000001",
            "code": "users:list",
            "verb": "просматривать всех пользователей",
            "title": "Просмотр всех пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        },
        {
            "id": "00000000-0000-0000-0004-000000000002",
            "code": "users:create",
            "verb": "создавать пользователей",
            "title": "Создание пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        }
    ]
}
{
    "message": "User does not have any of permissions: roles:list"
}
{
    "message": "Role not found: #00000000-0000-4000-8001-000000000009"
}

Обновить роль

PUT
https://id.stage.odinn.cloud
/api/v1/roles/{id}
requires authentication

Нельзя обновить системные роли: root, auth.

Требуемые разрешения: roles:update

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
a45bdd26-d9ce-3699-aec6-a7a1fb3040f4

Body Parameters

Example request:
curl --request PUT \
    "https://id.stage.odinn.cloud/api/v1/roles/a45bdd26-d9ce-3699-aec6-a7a1fb3040f4" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"code\": \"oeb\",
    \"name\": \"oehaudijcahomwjosi\",
    \"notes\": \"ihtzcidacpsqvebrq\",
    \"permissions\": [
        \"tfhjxnmmpttbnvpmtcd\"
    ]
}"
Example response:
{
    "id": "9e257a75-2853-40be-9934-9de8f10d524f",
    "code": "master",
    "name": "Мастер",
    "params": null,
    "notes": null,
    "author_id": null,
    "created_at": "2025-02-06T10:34:14.000000Z",
    "updated_at": "2025-02-06T10:34:14.000000Z",
    "permissions": [
        {
            "id": "00000000-0000-0000-0004-000000000001",
            "code": "users:list",
            "verb": "просматривать всех пользователей",
            "title": "Просмотр всех пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        },
        {
            "id": "00000000-0000-0000-0004-000000000002",
            "code": "users:create",
            "verb": "создавать пользователей",
            "title": "Создание пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        }
    ]
}
{
    "message": "User does not have any of permissions: roles:update"
}
{
    "message": "Role not found: #00000000-0000-4000-8001-000000000009"
}

Удалить роль

DELETE
https://id.stage.odinn.cloud
/api/v1/roles/{id}
requires authentication

Нельзя удалить системные роли: root, auth.

Требуемые разрешения: roles:delete

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
d051d199-0757-36e1-8192-5b60ace672e7
Example request:
curl --request DELETE \
    "https://id.stage.odinn.cloud/api/v1/roles/d051d199-0757-36e1-8192-5b60ace672e7" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "data": true
}
{
    "message": "User does not have any of permissions: roles:delete"
}
{
    "message": "System role cannot be deleted."
}
{
    "message": "Role not found: #00000000-0000-4000-8001-000000000009"
}

Permissions


Получить список всех разрешений

GET
https://id.stage.odinn.cloud
/api/v1/permissions
requires authentication

Массив объектов разрешений.

Требуемые разрешения: permissions:list

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Номер страницы.

Example:
1
page-size
integer

Количество элементов, возвращаемых на странице. По умолчанию 50.

Example:
50
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/permissions?page=1&page-size=50" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "current_page": 1,
    "data": [
        {
            "id": "00000000-0000-0000-0002-000000000001",
            "code": "roles:list",
            "verb": "просматривать все роли",
            "title": "Просмотр всех ролей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        },
        {
            "id": "00000000-0000-0000-0002-000000000002",
            "code": "roles:create",
            "verb": "создавать роли",
            "title": "Создание ролей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        },
        {
            "id": "00000000-0000-0000-0002-000000000003",
            "code": "roles:update",
            "verb": "обновлять роли",
            "title": "Обновление ролей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        },
        {
            "id": "00000000-0000-0000-0002-000000000004",
            "code": "roles:delete",
            "verb": "удалять роли",
            "title": "Удаление ролей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        }
    ],
    "first_page_url": "http://app_users:8080/api/v1/permissions?page=1",
    "from": 1,
    "last_page": 4,
    "last_page_url": "http://app_users:8080/api/v1/permissions?page=4",
    "links": [
        {
            "url": null,
            "label": "« Назад",
            "active": false
        },
        {
            "url": "http://app_users:8080/api/v1/permissions?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": "http://app_users:8080/api/v1/permissions?page=2",
            "label": "2",
            "active": false
        },
        {
            "url": "http://app_users:8080/api/v1/permissions?page=3",
            "label": "3",
            "active": false
        },
        {
            "url": "http://app_users:8080/api/v1/permissions?page=4",
            "label": "4",
            "active": false
        },
        {
            "url": "http://app_users:8080/api/v1/permissions?page=2",
            "label": "Вперёд »",
            "active": false
        }
    ],
    "next_page_url": "http://app_users:8080/api/v1/permissions?page=2",
    "path": "http://app_users:8080/api/v1/permissions",
    "per_page": 50,
    "prev_page_url": null,
    "to": 50,
    "total": 160
}
{
    "message": "User does not have any of permissions: permissions:list"
}

Создать разрешение

POST
https://id.stage.odinn.cloud
/api/v1/permissions
requires authentication

Требуемые разрешения: permissions:create

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
curl --request POST \
    "https://id.stage.odinn.cloud/api/v1/permissions" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"code\": \"wfjupitogsgrruwekfbsft\",
    \"verb\": \"gryiicxsjgueup\",
    \"title\": \"ctfjzjkfqnlmklwedchrsh\",
    \"notes\": \"znuovkeneqaeihir\"
}"
Example response:
{
    "id": "00000000-0000-0000-0002-000000054321",
    "code": "dms:bench:list",
    "verb": "просматривать все станки",
    "title": "Просмотр всех станков",
    "params": null,
    "notes": null,
    "author_id": null,
    "created_at": "2025-02-06T10:34:14.000000Z",
    "updated_at": null
}
{
    "message": "User does not have any of permissions: permissions:create"
}

Получить информацию о разрешении

GET
https://id.stage.odinn.cloud
/api/v1/permissions/{id}
requires authentication

Требуемые разрешения: permissions:list

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
8a039346-877f-3d0c-97ec-92907461f247
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/permissions/8a039346-877f-3d0c-97ec-92907461f247" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "id": "00000000-0000-0000-0002-000000000001",
    "code": "roles:list",
    "verb": "просматривать все роли",
    "title": "Просмотр всех ролей",
    "params": null,
    "notes": null,
    "author_id": null,
    "created_at": "2025-02-06T10:34:14.000000Z",
    "updated_at": null
}
{
    "message": "User does not have any of permissions: permissions:list"
}
{
    "message": "Permission not found: #00000000-0000-4000-8001-000000000009"
}

Обновить разрешение

PUT
https://id.stage.odinn.cloud
/api/v1/permissions/{id}
requires authentication

Нельзя обновить системные разрешения: user:, users:, roles:, permissions:.

Требуемые разрешения: permissions:update

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
6d1febf8-aaa5-337e-bf74-767babea71ad

Body Parameters

Example request:
curl --request PUT \
    "https://id.stage.odinn.cloud/api/v1/permissions/6d1febf8-aaa5-337e-bf74-767babea71ad" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"code\": \"mwtigmouynfurpgxwt\",
    \"verb\": \"tjgfoznnlnntcgbr\",
    \"title\": \"hooteviipt\",
    \"notes\": \"kijilz\"
}"
Example response:
{
    "id": "00000000-0000-0000-0002-000000054321",
    "code": "dms:bench:list",
    "verb": "просматривать все станки",
    "title": "Просмотр всех станков",
    "params": null,
    "notes": null,
    "author_id": null,
    "created_at": "2025-02-06T10:34:14.000000Z",
    "updated_at": null
}
{
    "message": "User does not have any of permissions: permissions:update"
}
{
    "message": "System role cannot be updated."
}
{
    "message": "Permission not found: #00000000-0000-4000-8001-000000000009"
}

Удалить разрешение

DELETE
https://id.stage.odinn.cloud
/api/v1/permissions/{id}
requires authentication

Нельзя удалить системные разрешения: user:, users:, roles:, permissions:.

Требуемые разрешения: permissions:delete

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
4da98470-b353-35fb-a262-185a70fff052
Example request:
curl --request DELETE \
    "https://id.stage.odinn.cloud/api/v1/permissions/4da98470-b353-35fb-a262-185a70fff052" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "data": true
}
{
    "message": "User does not have any of permissions: permissions:delete"
}
{
    "message": "System role cannot be deleted."
}
{
    "message": "Permission not found: #00000000-0000-4000-8001-000000000009"
}

Client API

Взаимодействие от имени клиента (сервиса)

Auth


Получение ключа клиента

POST
https://id.stage.odinn.cloud
/api/v1/client/login

access_token является JWT. Пример payload:

 {
  "aud": "9c876e62-6a44-455f-b33d-5dbe72475274",
  "jti": "8aa424247a29485b66af9670c7e6532b9f85504745bac4e74a653d78d6aaa4e4f9d938e8278fdc64",
  "iat": 1739180144.815972, // issued at time
  "nbf": 1739180144.815974,
  "exp": 1740389744.806619, // expire time
  "sub": "", // user_id здесь нет, т.к. это ключ для действий от имени сервиса
  "scopes": []
 }

Headers

Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
curl --request POST \
    "https://id.stage.odinn.cloud/api/v1/client/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"client_id\": \"241b7515-1175-3f66-97e8-7b2d3629af1f\",
    \"client_secret\": \"weepuxgznnw\"
}"
Example response:

Проверка авторизации клиента

GET
https://id.stage.odinn.cloud
/api/v1/client/check-auth
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/client/check-auth" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "data": true
}

Users


Создать пользователя

POST
https://id.stage.odinn.cloud
/api/v1/client/users
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
curl --request POST \
    "https://id.stage.odinn.cloud/api/v1/client/users" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"ch\",
    \"username\": \"rizuxfvsctcfgd\",
    \"password\": \"j:\'`zWAfI4f\",
    \"password_hash\": \"xwoiomobgavpciemchftpzjdhtkoucvyvybkhrpssykqkxfgirjdswdxdlwzprachzksbutbhapstkksvvltpcux\",
    \"phone\": \"11840201796\",
    \"email\": \"laura.auer@example.net\",
    \"roles\": [
        \"reiciendis\"
    ]
}"
Example response:
[
    {
        "id": "9e2d965e-2663-43d8-8316-c585f98d8748",
        "name": "lcezdywovqahbotk",
        "username": "mmhqxvvejbcgzvohwghbv",
        "email": "lexie38@example.org",
        "phone": "7437899606",
        "email_verified_at": null,
        "deleted_at": null,
        "created_at": "2025-02-10T11:18:54.000000Z",
        "updated_at": "2025-02-10T11:18:54.000000Z",
        "roles": [
            {
                "id": "9e257a75-2de3-4607-99db-91cf7c73850f",
                "code": "admin",
                "name": "Админ",
                "params": null,
                "notes": null,
                "author_id": null,
                "created_at": "2025-02-06T10:34:14.000000Z",
                "updated_at": "2025-02-06T10:34:14.000000Z"
            }
        ]
    }
]

Получить список пользователей

GET
https://id.stage.odinn.cloud
/api/v1/client/users
requires authentication

Получить список пользователей с возможностью фильтрации по времени обновления данных. Полезно для синхронизации обновлений данных пользователей от других сервисов.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

updated_after_timestamp
integer

Unix timestamp. Если задано - вернуться пользователи с временем обновления после этого значения. Значение поля value должно быть не меньше 1.

page
integer

Номер страницы.

Example:
1
page-size
integer

Количество элементов, возвращаемых на странице. По умолчанию 50.

Example:
50
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/client/users?page=1&page-size=50" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    access-control-allow-origin
                                                            : *
                                                         
{
    "message": "Unauthenticated."
}

Информация о пользователе

GET
https://id.stage.odinn.cloud
/api/v1/client/users/{id}
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
9e0046c2-d3ff-3a25-8339-e0b58deaa5da
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/client/users/9e0046c2-d3ff-3a25-8339-e0b58deaa5da" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
[
    {
        "id": "9e2d965e-2663-43d8-8316-c585f98d8748",
        "name": "lcezdywovqahbotk",
        "username": "mmhqxvvejbcgzvohwghbv",
        "email": "lexie38@example.org",
        "phone": "7437899606",
        "email_verified_at": null,
        "deleted_at": null,
        "created_at": "2025-02-10T11:18:54.000000Z",
        "updated_at": "2025-02-10T11:18:54.000000Z",
        "roles": [
            {
                "id": "9e257a75-2de3-4607-99db-91cf7c73850f",
                "code": "admin",
                "name": "Админ",
                "params": null,
                "notes": null,
                "author_id": null,
                "created_at": "2025-02-06T10:34:14.000000Z",
                "updated_at": "2025-02-06T10:34:14.000000Z"
            }
        ]
    }
]
{
    "message": "User not found: #00000000-0000-4000-8001-000000000009"
}

Обновить пользователя

PUT
https://id.stage.odinn.cloud
/api/v1/client/users/{id}
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
19558a26-983e-3bd9-a594-c7affd02a411

Body Parameters

Example request:
curl --request PUT \
    "https://id.stage.odinn.cloud/api/v1/client/users/19558a26-983e-3bd9-a594-c7affd02a411" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"aeanwtygw\",
    \"username\": \"labjuljotggfireywacfoj\",
    \"password\": \":KNFqy^#*2e(_xJkf:Wv\",
    \"password_hash\": \"cfaonfycprplvomlghwnxykdbdigpqvztnodpyuhwmraptwdqwngzrjpjoaiqtnmrgdqxjpofd\",
    \"phone\": \"46527938053\",
    \"email\": \"gbogisich@example.org\",
    \"roles\": [
        \"sequi\"
    ]
}"
Example response:
[
    {
        "id": "9e2d965e-2663-43d8-8316-c585f98d8748",
        "name": "lcezdywovqahbotk",
        "username": "mmhqxvvejbcgzvohwghbv",
        "email": "lexie38@example.org",
        "phone": "7437899606",
        "email_verified_at": null,
        "deleted_at": null,
        "created_at": "2025-02-10T11:18:54.000000Z",
        "updated_at": "2025-02-10T11:18:54.000000Z",
        "roles": [
            {
                "id": "9e257a75-2de3-4607-99db-91cf7c73850f",
                "code": "admin",
                "name": "Админ",
                "params": null,
                "notes": null,
                "author_id": null,
                "created_at": "2025-02-06T10:34:14.000000Z",
                "updated_at": "2025-02-06T10:34:14.000000Z"
            }
        ]
    }
]
{
    "message": "User not found: #00000000-0000-4000-8001-000000000009"
}

Разрешения

GET
https://id.stage.odinn.cloud
/api/v1/client/users/{id}/permissions
requires authentication

Получить разрешения пользователя в виде массива кодов

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
774c3502-7cc5-35e7-9444-93eeea05b38d
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/client/users/774c3502-7cc5-35e7-9444-93eeea05b38d/permissions" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
[
    "roles:list",
    "roles:create",
    "roles:update",
    "roles:delete",
    "roles:assign"
]
{
    "message": "User not found: #00000000-0000-4000-8001-000000000009"
}

Roles


Получить список всех ролей

GET
https://id.stage.odinn.cloud
/api/v1/client/roles
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Номер страницы.

Example:
1
page-size
integer

Количество элементов, возвращаемых на странице. По умолчанию 50.

Example:
50
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/client/roles?page=1&page-size=50" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "current_page": 1,
    "data": [
        {
            "id": "9e257a75-2853-40be-9934-9de8f10d524f",
            "code": "master",
            "name": "Мастер",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": "2025-02-06T10:34:14.000000Z"
        },
        {
            "id": "9e257a75-2de3-4607-99db-91cf7c73850f",
            "code": "admin",
            "name": "Админ",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": "2025-02-06T10:34:14.000000Z"
        }
    ],
    "first_page_url": "http://app_users:8080/api/v1/roles?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "http://app_users:8080/api/v1/roles?page=1",
    "links": [
        {
            "url": null,
            "label": "« Назад",
            "active": false
        },
        {
            "url": "http://app_users:8080/api/v1/roles?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": null,
            "label": "Вперёд »",
            "active": false
        }
    ],
    "next_page_url": null,
    "path": "http://app_users:8080/api/v1/roles",
    "per_page": 50,
    "prev_page_url": null,
    "to": 2,
    "total": 2
}

Создать роль

POST
https://id.stage.odinn.cloud
/api/v1/client/roles
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
curl --request POST \
    "https://id.stage.odinn.cloud/api/v1/client/roles" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"code\": \"ujruerzlnrr\",
    \"name\": \"sjeqyfmkdtaindwfur\",
    \"notes\": \"cgpzasjbtugy\",
    \"permissions\": [
        \"yxtulvrzhjcgvtym\"
    ]
}"
Example response:
{
    "id": "9e257a75-2853-40be-9934-9de8f10d524f",
    "code": "master",
    "name": "Мастер",
    "params": null,
    "notes": null,
    "author_id": null,
    "created_at": "2025-02-06T10:34:14.000000Z",
    "updated_at": "2025-02-06T10:34:14.000000Z",
    "permissions": [
        {
            "id": "00000000-0000-0000-0004-000000000001",
            "code": "users:list",
            "verb": "просматривать всех пользователей",
            "title": "Просмотр всех пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        },
        {
            "id": "00000000-0000-0000-0004-000000000002",
            "code": "users:create",
            "verb": "создавать пользователей",
            "title": "Создание пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        }
    ]
}

Получить информацию о роли

GET
https://id.stage.odinn.cloud
/api/v1/client/roles/{id}
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
98ea0013-74c5-3527-9a59-cfaed67356f6
Example request:
curl --request GET \
    --get "https://id.stage.odinn.cloud/api/v1/client/roles/98ea0013-74c5-3527-9a59-cfaed67356f6" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "id": "9e257a75-2853-40be-9934-9de8f10d524f",
    "code": "master",
    "name": "Мастер",
    "params": null,
    "notes": null,
    "author_id": null,
    "created_at": "2025-02-06T10:34:14.000000Z",
    "updated_at": "2025-02-06T10:34:14.000000Z",
    "permissions": [
        {
            "id": "00000000-0000-0000-0004-000000000001",
            "code": "users:list",
            "verb": "просматривать всех пользователей",
            "title": "Просмотр всех пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        },
        {
            "id": "00000000-0000-0000-0004-000000000002",
            "code": "users:create",
            "verb": "создавать пользователей",
            "title": "Создание пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        }
    ]
}
{
    "message": "Role not found: #00000000-0000-4000-8001-000000000009"
}

Обновить роль

PUT
https://id.stage.odinn.cloud
/api/v1/client/roles/{id}
requires authentication

Нельзя обновить системные роли: root, auth.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
e83802a4-05e5-3410-9a91-fa466337ee45

Body Parameters

Example request:
curl --request PUT \
    "https://id.stage.odinn.cloud/api/v1/client/roles/e83802a4-05e5-3410-9a91-fa466337ee45" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"code\": \"nllubmtjvdpqrps\",
    \"name\": \"rxjpysyoyuflnvqcq\",
    \"notes\": \"boprrgzb\",
    \"permissions\": [
        \"rwk\"
    ]
}"
Example response:
{
    "id": "9e257a75-2853-40be-9934-9de8f10d524f",
    "code": "master",
    "name": "Мастер",
    "params": null,
    "notes": null,
    "author_id": null,
    "created_at": "2025-02-06T10:34:14.000000Z",
    "updated_at": "2025-02-06T10:34:14.000000Z",
    "permissions": [
        {
            "id": "00000000-0000-0000-0004-000000000001",
            "code": "users:list",
            "verb": "просматривать всех пользователей",
            "title": "Просмотр всех пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        },
        {
            "id": "00000000-0000-0000-0004-000000000002",
            "code": "users:create",
            "verb": "создавать пользователей",
            "title": "Создание пользователей",
            "params": null,
            "notes": null,
            "author_id": null,
            "created_at": "2025-02-06T10:34:14.000000Z",
            "updated_at": null
        }
    ]
}
{
    "message": "Role not found: #00000000-0000-4000-8001-000000000009"
}

Удалить роль

DELETE
https://id.stage.odinn.cloud
/api/v1/client/roles/{id}
requires authentication

Нельзя удалить системные роли: root, auth.

Headers

Authorization
Example:
Bearer {YOUR_AUTH_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

id
uuid
required

Идентификатор (UUID)

Example:
fe3346b8-59ca-3d3d-a7b4-2017afb6125f
Example request:
curl --request DELETE \
    "https://id.stage.odinn.cloud/api/v1/client/roles/fe3346b8-59ca-3d3d-a7b4-2017afb6125f" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
Example response:
{
    "data": true
}
{
    "message": "System role cannot be deleted."
}
{
    "message": "Role not found: #00000000-0000-4000-8001-000000000009"
}