Creating a trigger using an API request

Use this request to create trigger.

POST

https://api.tracker.yandex.net/v3/queues/<queue_ID>/triggers

Query format

Before making a request, get permission to access the API.

To create a trigger, use an HTTP POST request. In the request body, specify the parameters in JSON format.

POST /v3/queues/<queue_ID>/triggers
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>

{
    "name": "<trigger_name>",
    "actions": [<trigger_action_parameters>],
    "conditions": [<trigger_condition_parameters>]
}
Headers
  • Host: Address of the node that provides the API.

  • Authorization: Authorization token about these formats:

    • OAuth <OAuth_token>: For authorization using the OAuth 2.0 protocol. Learn more

    • Bearer <IAM_token>: For authorization using an IAM token, if a Yandex Cloud Organization organization is linked to Tracker. Learn more

  • X-Org-ID or X-Cloud-Org-ID: Organization ID.

    • Use the X-Org-ID header if a Tracker organization is linked to Yandex 360 for Business.

    • Use the X-Cloud-Org-ID header if a Tracker organization is linked to Yandex Cloud Organization.

    To get the organization ID, go to AdministrationOrganizations and copy the value from the ID field.

Resource
Parameter Description Data type
<queue_ID> 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 For more information, see Trigger action objects. Array of objects

Additional parameters

Parameter Description Data type
conditions Array with trigger conditions For more information, see Trigger condition objects. Array of objects
active Trigger status Acceptable values include:
  • true: Active
  • false: Inactive
Boolean

Example: Creating 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 /v3/queues/DESIGN/triggers
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-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://api.tracker.yandex.net/v3/queues/DESIGN/triggers/16",
"queue": {
    "self": "https://api.tracker.yandex.net/v3/queues/DESIGN",
    "id": "26",
    "key": "DESIGN",
    "display": "Design"
},
"name": "trigger_name",
"order": "0.0002",
"actions": [
    {
        "type": "Transition",
        "id": 1,
        "status": {
            "self": "https://api.tracker.yandex.net/v3/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:
  • true: Active
  • false: Inactive
Boolean

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:
  • Transition: Change the issue status.
  • Update: Change a field value.
  • Move: Move issue.
  • Event.comment-create: Add a comment.
  • CreateChecklist: Create a checklist.
  • Webhook: Send an HTTP request.
  • CalculateFormula: Calculate a value.
  • Event.create: Create an issue.
String
id Action ID String
status Issue status String

conditions array object fields

Parameter Description Data type
type Condition type. Acceptable values:
  • or: Logical OR
  • and: Logical AND
String
conditions Array with trigger conditions.
For every condition, you can specify its type. Acceptable values:
  • CommentNoneMatchCondition: The comment does not contain any of the fragments.
  • CommentStringNotMatchCondition: The comment does not contain the fragment.
  • CommentFullyMatchCondition: The comment fully matches the fragment.
  • CommentAnyMatchCondition: The comment includes any of the fragments.
  • CommentStringMatchCondition: The comment includes the fragment.
  • CommentAuthorNot: The comment author does not match the fragment.
  • CommentAuthor: The comment author matches the fragment.
  • CommentMessageExternal: The comment type is Email.
  • CommentMessageInternal: The comment type is Common comment.
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
You are not authorized 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 again later.
503
The API service is temporarily unavailable.