Для AI-агентов: markdown этой страницы — /docs-content/entities/sites/ai/fields.md индекс документации — /llms.txt

Получить словарь полей генерации

GET /v1/sites/ai/fields

Получает определения полей ответа генерации.

Параметры

Параметр Тип Обяз. По умолчанию Описание
Параметрselect[] (query) Типarray Обяз.Нет По умолчаниюВсе свойства ОписаниеСвойства определений полей, например name, type, title. Это свойства каждого определения, а не имена полей ответа генерации

Примеры

curl — личный ключ

Terminal
curl -X GET "https://vibecode.bitrix24.tech/v1/sites/ai/fields" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth-приложение

Terminal
curl -X GET "https://vibecode.bitrix24.tech/v1/sites/ai/fields" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — личный ключ

javascript
const res = await fetch("https://vibecode.bitrix24.tech/v1/sites/ai/fields", {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_API_KEY"
  }
});
const result = await res.json();
console.log(result);

JavaScript — OAuth-приложение

javascript
const res = await fetch("https://vibecode.bitrix24.tech/v1/sites/ai/fields", {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_APP_KEY",
    "Authorization": "Bearer USER_SESSION_TOKEN"
  }
});
const result = await res.json();
console.log(result);

Поля ответа

Поле Тип Описание
Полеsuccess Типboolean Описаниеtrue при успехе
Полеdata Типarray ОписаниеОпределения полей генерации
Полеdata[].name Типstring ОписаниеИмя поля
Полеdata[].type Типstring ОписаниеТип значения
Полеdata[].title Типstring ОписаниеНазвание поля
Полеdata[].description Типstring | null ОписаниеОписание поля или null
Полеdata[].validationRules Типarray ОписаниеПравила проверки
Полеdata[].requiredGroups Типarray | null ОписаниеГруппы обязательности или null
Полеdata[].filterable Типboolean ОписаниеДоступность фильтрации
Полеdata[].sortable Типboolean ОписаниеДоступность сортировки
Полеdata[].editable Типboolean ОписаниеДоступность изменения
Полеdata[].editableGroups Типarray | null ОписаниеГруппы изменения или null
Полеdata[].multiple Типboolean ОписаниеМножественное значение
Полеdata[].elementType Типstring | null ОписаниеТип элемента или null

Пример ответа

JSON
{
  "success": true,
  "data": [
    {
      "name": "id",
      "type": "int",
      "title": "Site generation identifier",
      "description": null,
      "validationRules": [],
      "requiredGroups": null,
      "filterable": false,
      "sortable": false,
      "editable": false,
      "editableGroups": null,
      "multiple": false,
      "elementType": null
    },
    {
      "name": "status",
      "type": "string",
      "title": "Generation status: running, completed or failed",
      "description": null,
      "validationRules": [],
      "requiredGroups": null,
      "filterable": false,
      "sortable": false,
      "editable": false,
      "editableGroups": null,
      "multiple": false,
      "elementType": null
    },
    {
      "name": "siteId",
      "type": "int",
      "title": "Generated site identifier, 0 until the site is created",
      "description": null,
      "validationRules": [],
      "requiredGroups": null,
      "filterable": false,
      "sortable": false,
      "editable": false,
      "editableGroups": null,
      "multiple": false,
      "elementType": null
    },
    {
      "name": "pageId",
      "type": "int",
      "title": "Generated page identifier, 0 until the page is created",
      "description": null,
      "validationRules": [],
      "requiredGroups": null,
      "filterable": false,
      "sortable": false,
      "editable": false,
      "editableGroups": null,
      "multiple": false,
      "elementType": null
    },
    {
      "name": "draftSiteId",
      "type": "int",
      "title": "Draft site identifier of a failed generation that got as far as creating one, 0 otherwise",
      "description": null,
      "validationRules": [],
      "requiredGroups": null,
      "filterable": false,
      "sortable": false,
      "editable": false,
      "editableGroups": null,
      "multiple": false,
      "elementType": null
    },
    {
      "name": "draftPageId",
      "type": "int",
      "title": "Draft page identifier of a failed generation that got as far as creating one, 0 otherwise",
      "description": null,
      "validationRules": [],
      "requiredGroups": null,
      "filterable": false,
      "sortable": false,
      "editable": false,
      "editableGroups": null,
      "multiple": false,
      "elementType": null
    },
    {
      "name": "message",
      "type": "string",
      "title": "Human readable generation state, a text for the user - branch on status, not on it",
      "description": null,
      "validationRules": [],
      "requiredGroups": null,
      "filterable": false,
      "sortable": false,
      "editable": false,
      "editableGroups": null,
      "multiple": false,
      "elementType": null
    },
    {
      "name": "error",
      "type": "string",
      "title": "Human readable failure reason, null unless the status is failed",
      "description": null,
      "validationRules": [],
      "requiredGroups": null,
      "filterable": false,
      "sortable": false,
      "editable": false,
      "editableGroups": null,
      "multiple": false,
      "elementType": null
    },
    {
      "name": "errorDetails",
      "type": "string",
      "title": "Exact wording of the request limit that stopped the generation, null when something else did",
      "description": null,
      "validationRules": [],
      "requiredGroups": null,
      "filterable": false,
      "sortable": false,
      "editable": false,
      "editableGroups": null,
      "multiple": false,
      "elementType": null
    }
  ]
}

Пример ответа при ошибке

Запрос GET /v1/sites/ai/fields?select[]=FAKE_UNKNOWN_FIELD выбирает неизвестное свойство определения поля. Битрикс24 возвращает эту ошибку. Неизвестное имя поля в GET /v1/sites/ai/fields/FAKE_UNKNOWN_FIELD — другой случай: он возвращает ENTITY_NOT_FOUND (404).

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Неизвестное поле `FAKE_UNKNOWN_FIELD` для сущности `DtoFieldDto`",
    "b24Code": "BITRIX_REST_V3_EXCEPTION_UNKNOWNDTOPROPERTYEXCEPTION"
  }
}

Ошибки

HTTP Код Описание
HTTP422 КодBITRIX_ERROR ОписаниеБитрикс24 отказал в запросе
HTTP401 КодMISSING_API_KEY ОписаниеНе передан заголовок X-Api-Key
HTTP401 КодINVALID_API_KEY ОписаниеПлатформа не знает переданную строку ключа
HTTP401 КодTOKEN_MISSING ОписаниеКлюч приложения vibe_app_* передан без заголовка Authorization: Bearer с токеном сессии
HTTP401 КодTOKEN_MISSING ОписаниеУ личного ключа vibe_api_* нет вебхука портала. Причина приходит в error.details
HTTP403 КодSCOPE_DENIED ОписаниеКлючу не выдан скоуп landing

Общие ошибки.

Смотрите также