Skip to content

Triggers

Triggers provide a way to define automated actions that should be performed within the API in response to particular events. For example, whenever a new image is uploaded to an instance, run code which can detect objects in the image and automatically create new annotations for that image.

Currently, triggers are executed whenever new files are uploaded, and triggers apply to any file in an instance.

Get a list of triggers

Returns the list of triggers that have been created. Each trigger in the list is represented by its URI.

Route: /v3{instance-uri}/triggers
Method: GET

Sample response body:

{
  "success": true,
  "data": {
    "triggers": [
      "/triggers/1111-1111"
    ]
  }
}

Get details of a trigger

Returns the details for an individual trigger.

Route: /v3{instance-uri}{trigger-uri}
Method: GET

Sample response body:

{
  "success": true,
  "data": {
    "trigger": {
      "uri": "/triggers/1111-1111",
      "action": "/actions/detect-objects"
    }
  }
}

Create a trigger

Create a new trigger.

Route: /v3{instance-uri}/triggers
Method: POST

When creating a trigger, an action must be provided. Currently, triggers are executed whenever new files are uploaded, and triggers apply to any file in an instance.

Sample request body:

{
  "action": "/actions/detect-objects",
}

Upon successful creation of a trigger, the response will contain the details of the newly created trigger.

Delete a trigger

Delete a trigger.

Route: /v3{instance-uri}{trigger-uri}
Method: DELETE

Sample response body:

{
  "success": true
}