Skip to content

Trigger routes: update, delete

The Trigger Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for Trigger, one group of Trigger routes.

Trigger.update

Changes the given properties of a Trigger. Verb page.

Text
PATCH /{namespace}/triggers/{id}

Path: id. Body, as JSON: the other inputs. Emits Trigger.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Trigger.
eventstringThe Event selector it matches, such as Order.placed.
schedulestringA cadence or cron expression.
wherestringThe predicate an event Trigger matches, such as choice = 'raise'.
thresholdjsonA Metric staying below or above a value, optionally for a while, such as four weeks.
atstringWhen in its cadence a schedule runs, on the namespace’s clock, such as mon 09:00.

Returns

OutputTypeRequiredDescription
triggerTriggerrequiredThe Trigger.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X PATCH https://api.sb/leaseline.app/triggers/trigger_Hg9n0lrBdP \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"threshold":{}}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "trigger": {
    "$id": "https://api.sb/leaseline.app/triggers/trigger_Hg9n0lrBdP",
    "$type": "Trigger",
    "event": "Example event",
    "schedule": "Example schedule",
    "threshold": {}
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Trigger.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Trigger.delete

Deletes a Trigger: a soft delete that keeps its history, undone by Thing.restore. Verb page.

Text
DELETE /{namespace}/triggers/{id}

Path: id. Emits Trigger.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Trigger.

Returns

OutputTypeRequiredDescription
triggerTriggerrequiredThe Trigger.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X DELETE https://api.sb/leaseline.app/triggers/trigger_Hg9n0lrBdP \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "trigger": {
    "$id": "https://api.sb/leaseline.app/triggers/trigger_Hg9n0lrBdP",
    "$type": "Trigger",
    "event": "Example event",
    "schedule": "Example schedule"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Trigger.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}