Create an issue field
Use this request to create an issue global field.
Request format
Before making the request, get permission to access the API.
To create a field, use an HTTP POST
request. Request parameters are passed in the request body in JSON format:
POST /v2/fields
Host: https://api.tracker.yandex.net
Authorization: OAuth <OAuth token>
X-Org-ID: <organization ID>
{
"name":
{
"en": "Name in English",
"ru": "Name in Russian"
},
"id": "global_field_key",
"category": "000000000000000000000001",
"type": "ru.yandex.startrek.core.fields.StringFieldType"
}
-
Host
API host address:
https://api.tracker.yandex.net
-
Authorization
OAuth token in
OAuth <token value>
format. For example:OAuth 0c4181a7c2cf4521964a72ff57a34a07
-
X-Org-ID
Organization ID.
Required parameters
Parameter | Description | Data type |
---|---|---|
name | Field name:
|
String |
id | Field ID. | String |
category | Object with information about the field category. To get a list of all categories, use the HTTP request: GET /v2/fields/categories |
String |
type | Field type:
|
String |
Additional parameters
Parameter | Description | Data type |
---|---|---|
optionsProvider | Object with information about the list items. | Object |
order | Sequence number in the list of organization fields: https://tracker.yandex.com/admin/fields. | Number |
description | Field description. | String |
readonly | Shows if the field value is editable:
|
Boolean |
visible | Indicates if the field is visible in the interface:
|
Boolean |
hidden | Indicates if the field should be hidden in the interface:
|
Boolean |
container | Indicates if you can specify multiple values in the field (like in the Tags field):
|
Boolean |
Object fields optionsProvider
Parameter | Description | Data type |
---|---|---|
type | Type of drop-down list:
|
String |
values | Drop-down list values. | Array of strings |
Example: Create a field of the
Drop-down listtype with a fixed set of string values:
- An HTTP POST method is used.
- Field type:
FixedListOptionsProvider
.- Drop-down list values:
the first list item,the second list item,the third list item.
POST /v2/fields Host: https://api.tracker.yandex.net Authorization: OAuth <OAuth token> X-Org-Id: <organization ID> { "name": { "en": "Name in English", "ru": "Name in Russian" }, "id": "myglobalfield", "category": "000000000000000000000003", "type": "ru.yandex.startrek.core.fields.StringFieldType", "optionsProvider": { "type": "FixedListOptionsProvider", "values": [ "the first list item", "the second list item", "the third list item" ] } }
Response format
If the request is successful, the API returns a response with code 200 OK
.
The response body contains information about the created issue field in JSON format.
{
"self": "https://api.tracker.yandex.net/v2/fields/global_field_key",
"id": "global_field_key",
"name": "Field name in Russian",
"description": "Field description",
"key": "global_field_key",
"version": 1,
"schema": {
"type": "array",
"items": "string",
"required": false
},
"readonly": false,
"options": true,
"suggest": false,
"optionsProvider": {
"type": "FixedListOptionsProvider",
"needValidation": true,
"values": [
"The first list item",
"The second list item",
"The third list item"
]
},
"queryProvider": {
"type": "StringOptionalQueryProvider"
},
"order": 5,
"category": {
"self": "https://api.tracker.yandex.net/v2/fields/categories/000000000000000000000001",
"id": "000000000000000000000001",
"display": "System"
},
"type": "standard"
}
Parameter | Description | Data type |
---|---|---|
type | Field type. | String |
self | Address of the API resource with information about the field. | String |
id | Unique field ID. | String |
name | Field name. | String |
description | Field description. | String |
key | Field key. | String |
version | Field version. Each change to the field increases the version number. | Number |
schema | Object with information about the field value's data type. | Object |
readonly | Shows if the field value is editable:
|
Boolean |
options | Shows if the list of values is restricted:
|
Boolean |
suggest | Enables/disables search suggestions when entering field values:
|
Boolean |
optionsProvider | Object with information about the drop-down list items. | Object |
queryProvider | Object with information about the query language class. You can't change the class using the API. |
Object |
order | Sequence number in the list of organization fields: https://tracker.yandex.com/admin/fields | Number |
category | Object with information about the field category. To get a list of all categories, use the HTTP request: GET /v2/fields/categories |
Object |
Object fields schema
Parameter | Description | Data type |
---|---|---|
type | Field value type. Possible data types:
|
String |
items | Value type. Available for fields with multiple values. | String |
required | Shows if the field is required:
|
Boolean |
Object fields optionsProvider
Parameter | Description | Data type |
---|---|---|
type | Type of drop-down list. | String |
needValidation | Indicates if a list value requires validation:
|
Boolean |
values | List items. | Array of strings |
Object fields queryProvider
Parameter | Description | Data type |
---|---|---|
type | Query language type. | String |
Object fields category
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource with information about the field category. | String |
id | Field category ID. | String |
display | Category name displayed. | String |
If the request is processed incorrectly, the API returns a response with an error code:
- 400
- One or more request parameters have an invalid value.
- 401
- The user isn't authorized. Make sure to perform the actions described in API access.
- 403
- Insufficient rights to perform this action. You can check what rights you have in the Tracker interface. The same rights are required to perform an action via the API and interface.
- 404
- The requested object was not found. You may have specified an invalid object ID or key.
- 422
- JSON validation error, the request is rejected.
- 500
- Internal service error. Try resending your request in a few minutes.
- 503
- The API service is temporarily unavailable.