Create auto action
Use this request to create auto action.
Request format
Before making the request, get permission to access the API.
To create an auto action, use an HTTP POST
request. Request parameters are provided in the request body in JSON format.
POST /v2/queues/<queue_ID_or_key>/autoactions
Host: https://api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID: <organization ID>
{
"name": "<autoaction_name>",
"filter": [<filtering_conditions>],
"actions": [<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
Note
In the request body, specify at least one of the parameters: filter
or query
.
Parameter | Description | Data type |
---|---|---|
name | Auto action name | String |
filter | Array with the issue field filtering conditions that will trigger the auto action | Array of objects |
query | The query string to filter the issues that will trigger the auto action. The Query language is used. For example: "query": "\"Status\":\"In progress\"" |
String |
actions | Array of actions on issues | Array of objects |
Additional parameters
Parameter | Description | Data type |
---|---|---|
active | Auto action status. Acceptable values include:
|
Logical |
enableNotifications | Notification sending statuses. Acceptable values include:
|
Logical |
intervalMillis | Auto action start frequency in milliseconds. The default value is 3600000 (once an hour). |
Number |
calendar | Period for which the auto action is active. It has the id parameter specifying the work schedule ID. |
Object |
Example: Create an auto action that triggers on issues that meet the filter criteria and changes the status of the issues.
- An HTTP POST method is used.
- Create an auto action for the DESIGN queue.
- Filter criteria: issues in the In progress status with Priority set to Critical.
- Action performed: the issue status changes to Need info.
- Trigger period: work schedule with the ID of
2
.
POST /v2/queues/DESIGN/autoactions Host: https://api.tracker.yandex.net Authorization: OAuth <OAuth token> X-Org-ID: <organization ID> { "name": "AutoactionName", "filter": { "priority": [ "critical" ], "status": [ "inProgress" ] }, "actions": [ { "type": "Transition", "status": { "key": "needInfo" } } ], "calendar": { "id": 2 } }
Response format
If the request is successful, the API returns a response with code 200 OK
.
The request body contains information about the created auto action in JSON format.
{
"id": 9,
"self": "https://https://api.tracker.yandex.net/v2/queues/DESIGN/autoactions/9",
"queue": {
"self": "https://https://api.tracker.yandex.net/v2/queues/DESIGN",
"id": "26",
"key": "DESIGN",
"display": "Design"
},
"name": "autoaction_name",
"version": 1,
"active": true,
"created": "2022-01-21T17:10:22.993+0000",
"updated": "2022-01-21T17:10:22.993+0000",
"filter": {
"assignee": [
"13********"
],
"priority": [
"critical"
]
},
"actions": [
{
"type": "Transition",
"id": 1,
"status": {
"self": "https://https://api.tracker.yandex.net/v2/statuses/2",
"id": "2",
"key": "needInfo",
"display": "Need info"
}
}
],
"enableNotifications": false,
"totalIssuesProcessed": 0,
"intervalMillis": 3600000,
"calendar": {
"id": 2
}
}
Response parameters
Parameter | Description | Data type |
---|---|---|
id | Auto action ID | String |
self | Link to the auto action | String |
queue | Queue to create the auto action. | Can be set as an object, a string (if the queue key is provided), or a number (if the queue ID is provided). |
name | Auto action name | String |
version | Auto action version. Each change to the auto action increases the version number. | Number |
active | Auto action status. Acceptable values include:
|
Logical |
created | Auto action creation date and time in YYYY-MM-DDThh:mm:ss.sss±hhmm format |
String |
updated | Date and time of the auto action's last update in YYYY-MM-DDThh:mm:ss.sss±hhmm format |
String |
filter | Array with the issue field filtering conditions that will trigger the auto action | Array of objects |
query | Query string for filtering issues | String |
actions | Array of actions on issues | Array of objects |
enableNotifications | Notification sending statuses. Acceptable values include:
|
Logical |
totalIssuesProcessed | Number of issues checked by the auto action when triggered last time | Number |
intervalMillis | Auto action start frequency in milliseconds. The default value is 3600000 (once an hour). |
Number |
calendar | Period for which the auto action is active. It has the id parameter specifying the work schedule ID. |
Object |
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 |
filter
array object fields
Parameter | Description | Data type |
---|---|---|
filter | Array with filtering conditions for issue fields. Use the request to get the ID of the global or local field. |
Array of objects |
actions
array object fields
Parameter | Description | Data type |
---|---|---|
type | Action type. Acceptable values include:
|
String |
id | Action ID | String |
status | Issue status | String |
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.
- 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.