Skip to content

Workflow routes: update, delete

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

Reference for Workflow, one group of Workflow routes.

Workflow.update

Changes the given properties of a Workflow. Verb page.

Text
PATCH /{namespace}/workflows/{id}

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

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Workflow.
stepsjsonThe ordered steps, each run by a Function.
retriesintegerHow many times a failed step retries.
bodystringThe Verb whose Action it is the durable body of, such as Order.refund; a Workflow with a body has no Trigger.

Returns

OutputTypeRequiredDescription
workflowWorkflowrequiredThe Workflow.

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/workflows/workflow_2dhYBlEno0 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"steps":{}}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "workflow": {
    "$id": "https://api.sb/leaseline.app/workflows/workflow_2dhYBlEno0",
    "$type": "Workflow",
    "steps": {}
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Workflow.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Workflow.delete

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

Text
DELETE /{namespace}/workflows/{id}

Path: id. Emits Workflow.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Workflow.

Returns

OutputTypeRequiredDescription
workflowWorkflowrequiredThe Workflow.

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/workflows/workflow_2dhYBlEno0 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "workflow": {
    "$id": "https://api.sb/leaseline.app/workflows/workflow_2dhYBlEno0",
    "$type": "Workflow",
    "steps": [
      {
        "do": "Lease.list",
        "where": "endsOn is 60 days away"
      },
      {
        "do": "Lease.notify"
      },
      {
        "do": "Message.create",
        "medium": "email"
      }
    ]
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Workflow.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}