Updating a trigger using an API request

Use this request to update a trigger.

PATCH

https://api.tracker.yandex.net/v3/queues/<queue_ID>/triggers/<trigger_ID>?version=<trigger_current_version>

Query format

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

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

PATCH /v3/queues/<queue_ID>/triggers/<trigger_ID>?version=<current_trigger_version>
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
<trigger_ID> Trigger ID Number
<current_trigger_version> Current trigger version Number

To find the current trigger version, use the request for getting trigger parameters.

Request body parameters

Additional parameters

Parameter Description Data type
name Trigger name String
actions Array with trigger action objects For more information, see Trigger action objects. Array of objects
conditions Array with trigger conditions. For more information, see Trigger conditions. Array of objects
active Trigger status Acceptable values include:
  • true: Active
  • false: Inactive
Boolean
before ID of the trigger before which to place this trigger Number

Trigger conditions

Depending on whether all or at least one condition is to be met, you can specify the conditions field value in one of the two formats: either () or an array of objects including both the array of elementary trigger condition objects and the type of a logical combination of conditions:

  • Array of elementary trigger condition objects. For more information, see Trigger condition objects.

    In this case, the trigger will fire when all conditions are met, like when conditions are combined with the “logical AND” operator.

    {
        "conditions": [
           {<trigger_condition_1>},
           {<trigger_condition_2>}
        ]
    }
    
  • Object indicating the type for combining trigger conditions:

    Parameter Description Data type
    type Type of logical combination of trigger conditions. Acceptable values include:
    • Or: Logical OR (Any)
    • And: Logical AND (All)
    String
    conditions Array with elementary trigger condition objects Array of objects
    {
        "conditions": {
            "type": "Or",
            "conditions": [
                {<trigger_condition_1>},
                {<trigger_condition_2>}
            ]
        }
    }
    

Examples

  1. Trigger that fires when at least one condition is met.
  2. Updating a trigger action.
  3. Trigger that fires when a group of conditions is met.
  4. Disabling a trigger.
  5. Moving a trigger in the list and activating it.

Example 1: Changing trigger conditions and trigger action. The trigger must fire if at least one of the conditions is met.

  • The HTTP PATCH method is used.
  • The trigger for the DESIGN queue is being updated.
  • The trigger ID is 16 and its current version is 1.
  • The trigger condition is updated: the comment text matches the Need info phrase.
  • Trigger action: the issue status changes to Need info.
PATCH /v3/queues/DESIGN/triggers/16?version=1
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>
{
  "actions": [
      { "type": "Transition",
          "status": {
             "key": "needInfo"
          }
      }
  ],
  "conditions": [
      { "type": "Or",
           "conditions": [
               { "type": "CommentFullyMatchCondition", "word": "Need info" },
               { "type": "CommentFullyMatchCondition", "word": "Need info" }
           ]
      }
  ]
}

Example 2: Updating a trigger action.

  • The HTTP PATCH method is used.
  • The trigger for the DESIGN queue is being updated.
  • The trigger ID is 16 and its current version is 2.
  • Trigger action changes: a checklist is created with the item names, assignee, and deadline specified.
PATCH /v3/queues/DESIGN/triggers/16?version=2
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>
{
  "actions": [
     {
        "type": "CreateChecklist",
        "checklistItems": [
           {
              "text": "Do that",
              "assignee": "username",
              "deadline": {"date": "2025-05-23"}
           },
           {
              "text": "Do this",
              "assignee": "username",
              "deadline": {"date": "2025-05-23"}
           },
           {"text": "Report the results"}
        ]
     }
  ]
}

Example 3: Changing trigger conditions and trigger action. The trigger must fire when one of the condition groups is met.

  • The HTTP PATCH method is used.
  • The trigger for the DESIGN queue is being updated.
  • The trigger ID is 16 and its current version is 3.
  • The trigger condition is updated: Trigger is activated if one of the condition groups is met:
  • Comment text matches the Need info phrase and the issue status is In progress.
  • Comment text matches the No data phrase.
  • Trigger action changes: the issue status changes to Need info.
PATCH /v3/queues/DESIGN/triggers/16?version=3
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>

{
   "actions": [
       {
           "type": "Transition",
           "status": {
               "key": "needInfo"
           }
       }
   ],
   "conditions": [
       {
           "type": "Or",
           "conditions": [
               {
                   "type": "And",
                   "conditions": [
                       {
                           "ignoreCase": false,
                           "noMatchBefore": false,
                           "removeMarkup": false,
                           "type": "CommentFullyMatchCondition",
                           "word": "Need info"
                       },
                       {
                           "type": "FieldEquals",
                           "field": "status",
                           "value": "inProgress"
                       }
                   ]
               },
               {
                   "ignoreCase": false,
                   "noMatchBefore": false,
                   "removeMarkup": false,
                   "type": "CommentFullyMatchCondition",
                   "word": "No data"
               }
           ]
       }
   ]
}

Example 4: Deactivating a trigger.

  • The HTTP PATCH method is used.
  • The trigger for the DESIGN queue is being updated.
  • The trigger ID is 16 and its current version is 4.
  • The trigger is deactivated.
PATCH /v3/queues/DESIGN/triggers/16?version=4
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>
{
  "active": false
}

Example 5: Moving a trigger in the list and activating it.

  • The HTTP PATCH method is used.
  • The trigger for the DESIGN queue is being updated.
  • The trigger ID is 16 and its current version is 4.
  • The trigger is moved and placed before the trigger with the 6 ID and then activated.
PATCH /v3/queues/DESIGN/triggers/16?version=4
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>
{ "before": 6, "active": true }

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": "TriggerName",
   "order": "0.0002",
   "actions": [
      {
         "type": "Transition",
         "id": 2,
         "status": {
            "self": "https://api.tracker.yandex.net/v3/statuses/2",
            "id": "2",
            "key": "needInfo",
            "display": "Need info"
         }
      }
   ],
   "conditions": [
      {
         "type": "Or",
         "conditions": [
            {
               "type": "CommentFullyMatchCondition",
               "word": "Need info",
               "ignoreCase": true,
               "removeMarkup": true,
               "noMatchBefore": false
            },
            {
               "type": "CommentFullyMatchCondition",
               "word": "Need info",
               "ignoreCase": true,
               "removeMarkup": true,
               "noMatchBefore": false
            }
         ]
      }
      ],
      "version": 2,
      "active": true
   }

Response parameters
Parameter Description Data type
id Trigger ID String
self Links to trigger String
queue Queue to create the trigger Map item
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 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

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.
412
A conflict occurred while 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.