Create a trigger using an API request
Use this request to create trigger.
Request format
Before making the request, get permission to access the API.
To create a trigger, use an HTTP POST
request. Request parameters are provided in the request body in JSON format.
POST /v2/queues/<queue_ID_or_key>/triggers
Host: https://api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID: <organization ID>
{
"name": "<trigger_name>",
"actions": [<trigger_action_parameters>]
}
Headers
-
Host
Address of the node that provides the API:
https://api.tracker.yandex.net
-
Authorization
OAuth token in
OAuth <OAuth_token>
format, e.g.:OAuth 0c4181a7c2cf4521964a72ff********
-
X-Org-ID or X-Cloud-Org-ID
Organization ID. You can find it out on the Tracker organizations page
.- If a Yandex 360 for Business organization is the only one linked to Tracker, the
X-Org-ID
header is used. - If a Yandex Cloud Organization organization is the only one linked to Tracker, the
X-Cloud-Org-ID
header is used. - If both Yandex 360 for Business and Yandex Cloud Organization organizations are linked to Tracker at the same time, the
X-Org-ID
header and the Yandex 360 for Business organization ID are used.
- If a Yandex 360 for Business organization is the only one linked to Tracker, the
Resource
Parameter | Description | Data type |
---|---|---|
<queue_ID_or_key> | Queue ID or key. The queue key is case-sensitive. | String or number |
Request body parameters
Required parameters
Parameter | Description | Data type |
---|---|---|
name | Trigger name | String |
actions | Array with trigger actions. | Array of objects |
Additional parameters
Parameter | Description | Data type |
---|---|---|
conditions | Array with trigger conditions. | Array of objects |
active | Trigger status Acceptable values include:
|
Logical |
Example: Create a trigger that fires at a specified condition and changes the issue status.
- An HTTP POST method is used.
- Create a trigger for the DESIGN queue.
- Trigger condition: the comment text matches Open.
- Trigger action: issue status changes to Open.
POST /v2/queues/DESIGN/triggers Host: https://api.tracker.yandex.net Authorization: OAuth <OAuth token> X-Org-ID: <organization ID> { "name": "TriggerName", "actions": [ { "type": "Transition", "status": { "key": "open" } } ], "conditions": [ { "type": "CommentFullyMatchCondition", "word": "Open" } ] }
Response format
If the request is successful, the API returns a response with code 200 OK
.
The request body contains information about the created trigger in JSON format.
{
"id": 16,
"self": "https://https://api.tracker.yandex.net/v2/queues/DESIGN/triggers/16",
"queue": {
"self": "https://https://api.tracker.yandex.net/v2/queues/DESIGN",
"id": "26",
"key": "DESIGN",
"display": "Desing"
},
"name": "trigger_name",
"order": "0.0002",
"actions": [
{
"type": "Transition",
"id": 1,
"status": {
"self": "https://https://api.tracker.yandex.net/v2/statuses/2",
"id": "2",
"key": "needInfo",
"display": "Need info"
}
}
],
"conditions": [
{
"type": "Or",
"conditions": [
{
"type": "Event.comment-create"
}
]
}
],
"version": 1,
"active": true
}
Response parameters
Parameter | Description | Data type |
---|---|---|
id | Trigger ID | String |
self | Links to trigger | String |
queue | Queue to create the trigger | Can be set as an object, a string (if the queue key is provided), or a number (if the queue ID is provided). |
name | Trigger name | String |
order | Trigger weight. This parameter affects the order of trigger display in the interface. | String |
actions | Array with trigger actions | Array of objects |
conditions | Array with trigger conditions | Array of objects |
version | Trigger version. Each trigger update increases the version number. | Number |
active | Trigger status Acceptable values include:
|
Logical |
queue
object fields
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource with information about the queue. | String |
id | Queue ID. | String |
key | Queue key. | String |
display | Queue name displayed. | String |
actions
array object fields
Parameter | Description | Data type |
---|---|---|
type | Action type. Acceptable values include:
|
String |
id | Action ID | String |
status | Issue status | String |
conditions
array object fields
Parameter | Description | Data type |
---|---|---|
type | Condition type. Acceptable values:
|
String |
conditions | Array with trigger conditions. For every condition, you can specify its type . Acceptable values:
|
Array of objects |
status
array object fields
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource with information about the status. | String |
id | Status ID. | String |
key | Status key. | String |
display | Status name displayed. | String |
If the request is processed incorrectly, the API returns a message with error details:
- 400
- One or more request parameters have an invalid value.
- 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.
- 409
- There was a conflict when editing the object. The error may be due to an invalid update version.
- 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.