Перейти к содержимому

Создать поле в справочнике

POST
/entities/{entity_id}/fields

Авторизация

bearer
headerAuthorizationBearer <token>

Токен сервисного аккаунта. См. раздел «Аутентификация».

Параметры пути

entity_id*number

Тело запроса

application/json
body
type*string
Значения"string""integer""date""relation""id""code""title""created_at""updated_at""coordinate"
code*string
title*string
Длинаот 1 до 100 символов
is_required*boolean
relation_entity_id?number

Тело ответа

responseapplication/json
id*number
code*string
title*string
type*string
Значения"string""integer""date""relation""id""code""title""created_at""updated_at""coordinate"
is_required*boolean
data*EntityFieldDataDto
created_at*string
Форматdate-time
updated_at*string
Форматdate-time

Возможные ошибки

401Unauthorized

unauthorized: Необходима авторизация

{  "statusCode": 401,  "error": "unauthorized",  "message": "Необходима авторизация"}
403Forbidden

access_denied: Недостаточно прав

{  "statusCode": 403,  "error": "access_denied",  "message": "Недостаточно прав"}
404Not Found

entity_not_found: Справочник не найден

{  "statusCode": 404,  "error": "entity_not_found",  "message": "Справочник не найден"}
409Conflict

entity_field_already_exists: Такое поле уже существует

{  "statusCode": 409,  "error": "entity_field_already_exists",  "message": "Такое поле уже существует"}
Пример запроса
curl -X POST 'https://org.inspecto.in/api/entities/0/fields' \  -H 'Content-Type: application/json' \  -d '{  "type": "string",  "code": "string",  "title": "string",  "is_required": true}'
Пример ответа
{  "id": 0,  "code": "string",  "title": "string",  "type": "string",  "is_required": true,  "relation_entity": {    "organization_id": 0,    "id": 0,    "code": "string",    "title": "string",    "description": "string",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z"  },  "data": {},  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}