Creating a macro
Written by
Updated at February 19, 2024
Use this request to create macros.
Request format
Before making the request, get permission to access the API.
To create a macro, use an HTTP POST
request:
POST /v2/queues/<queue_key_or_ID>/macros
Host: https://api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID: <organization ID>
{
"name": "<macro_name>",
"body": "<comment_text>\n{{currentDateTime}}\n{{issue.author}}",
"fieldChanges": [
{
"field": "<issue_field_ID>",
"value": "<issue_field_value>"
},
...
]
}
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 |
Request body parameters
Required parameters
Parameter | Value | Data type |
---|---|---|
name | Macro name. | String |
Additional parameters
Parameter | Description | Data type |
---|---|---|
body | Message to be created when executing the macro. Use a special format for the message text. To delete a message, use "body": {"unset":1} |
String |
fieldChanges | Array with information about the issue fields that the macro will trigger changes to. | Array of objects |
fieldChanges array objects
Parameter | Description | Data type |
---|---|---|
field | Issue field ID. Full list of issue fields |
String |
value | Issue field value. | String |
Response format
Request executed successfully
Request failed
If the request is successful, the API returns a response with code 200 OK
.
The response body contains a JSON object with the parameters of the created macro.
{
"self": "https://https://api.tracker.yandex.net/v2/queues/TEST/macros/3",
"id": 3,
"queue": {
"self": "https://https://api.tracker.yandex.net/v2/queues/TEST",
"id": "1",
"key": "TEST",
"display": "Test queue"
},
"name": "Test macro",
"body": "Test comment\n{{currentDateTime}}\n{{issue.author}}",
"fieldChanges": [
{
"field": {
"self": "https://https://api.tracker.yandex.net/v2/fields/tags",
"id": "tags",
"display": "Tags"
},
"value": [
"tag1"
]
},
...
]
}
Response parameters
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource with macro parameters. | String |
id | Macro ID. | Number |
queue | Object with information about the queue whose issues that the macro is applied to. | Object |
name | Macro name. | String |
body | Message to be created when executing the macro. | String |
fieldChanges | Array with information about the issue fields that the macro will trigger changes to. | Array of objects |
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 |
fieldChanges
object fields
Parameter | Description | Data type |
---|---|---|
field | Object with information about the issue field. | Object |
value | Array of issue field values. | Array of objects |
field
object fields
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource with information about the issue field. | String |
id | Issue field ID. | String |
display | Issue field 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.
- 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.
- 500
- Internal service error. Try resending your request in a few minutes.
- 503
- The API service is temporarily unavailable.