Triggers

Create

Creates a trigger listening on a set of tables.

Token has to be master (then runWithTokenId can be also master). If it isn't master, it has to have canManageBuckets permission or componentAccess permission for the component which you want to trigger. This also applies when updating and deleting triggers. When updating the component of trigger you need permissions for both the current component and the component you're updating the trigger to.

Without runWithTokenId, the trigger creates the token it runs with, in the same request, and owns it:

  • The token never expires and is named [_internal] Token for triggering <configurationId>.
  • In a project with a protected default branch it can only create jobs; elsewhere it can manage buckets and read all file uploads.
  • Your token has to be able to create that token.
  • If the trigger cannot be created, no token is left behind.
  • Deleting the trigger, or giving it another token, revokes the token.
post/v2/storage/triggers

Request

Request body

runWithTokenIdinteger nullable

ID of the token that runs the configured component. When omitted or null, the trigger creates a non-expiring token [_internal] Token for triggering <configurationId> and owns it: deleting the trigger, or giving it another token, revokes that token.

componentstring required

Component ID of the triggered configuration (typically orchestration).

configurationIdstring required

ID of component configuration.

coolDownPeriodMinutesinteger required

Minimal cool down period before firing action again in minutes (min is 1 minute).

tableIdsstring[] required

IDs of tables to watch (like in.c-test.watched).

Example request

{
  "runWithTokenId": 123,
  "component": "orchestration",
  "configurationId": "123",
  "coolDownPeriodMinutes": 20,
  "tableIds": [
    "in.c-test.watched-1",
    "in.c-prod.watched-5"
  ]
}

Response

Trigger created.

idstring required

Trigger ID.

runWithTokenIdinteger required

ID of token used for running configured component.

componentstring required

Component ID of the triggered configuration.

configurationIdstring required

ID of component configuration.

lastRunstring nullable required

Time of the last trigger run, ISO 8601 with a +hhmm offset; null if never fired.

coolDownPeriodMinutesinteger required

Minimal cool down period before firing action again in minutes.

Example response

{
  "id": "3",
  "runWithTokenId": 123,
  "component": "orchestration",
  "configurationId": "config-100",
  "lastRun": "2017-02-13T12:01:05+0100",
  "creatorToken": {
    "id": 1,
    "description": "dev@keboola.com"
  },
  "coolDownPeriodMinutes": 20,
  "tables": [
    {
      "tableId": "in.c-test.watched-1"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.