POST /workflow/runs/{id}/stop¶
Use the workflow/runs/{id}/stop to stop a running workflow.
Available HTTP methods¶
Prerequisites¶
Base URL¶
All requests made to the workflow/runs/{id}/stop endpoint should be directed to the following base URL:
https://{tenant-id}.amperity.com/api/workflow/runs/{id}/stop
Rate limit¶
A rate limit is the number of requests that may be made to the Amperity API in a given time period.
The Amperity API supports requests to endpoints that do not exceed a rate of 10 requests per second. Response times will vary by endpoint and the complexity of data that is returned by the response. Some requests may take seconds to return.
Requests to the Amperity API that exceed 10 requests per second may return an error response with an HTTP 429 status code.
Requests¶
A request to the workflow/runs/{id}/stop endpoint is similar to:
curl --request POST \
"https://app.amperity.com/api/workflow/runs/{id}/stop" \
--header 'amperity-tenant: tenant' \
--header 'api-version: 2024-04-01' \
--header 'Authorization: Bearer token'
(This example is formatted for readability in a narrow page layout.)
Request parameters¶
The following table describes the parameters that may be used with the workflow/runs/{id}/stop endpoint.
Parameter |
Description |
---|---|
api_version |
String. Optional. A supported version of the Amperity API. For example: 2024-04-01. Note You may use the api-version request header instead of the api_version request parameter. |
{id} |
String. Required. The Amperity internal identifier for the workflow. For example wf-20240619-14418-6UhqSe. Note On the workflows page, under Actions, copy the workflow id from the dropdown. |
Request examples¶
The following examples show how to send requests to the workflow/runs/{id}/stop endpoint.
cURL¶
The following example shows how to use cURL to send a request to the workflow/runs/{id}/stop endpoint.
curl --request GET \
'https://tenant.amperity.com/api/workflow/runs/{id}/stop" \
--header 'amperity-tenant: tenant' \
--header 'api-version: 2024-04-01' \
--header 'Authorization: Bearer token'
(This example is formatted for readability in a narrow page layout.)
Responses¶
A response from the workflow/runs/{id}/stop endpoint will match an HTTP status code. A 200 response will contain workflow details for the workflow run that was stopped. A 4xx response indicates an issue with the configuration of your request. A 5xx response indicates that the endpoint is unavailable.
200 OK¶
The 200 response returns details for the workflow that was stopped.
{
"id":"wf-20240801-65278-x9E9U",
"type":"campaign.send",
"name":"testing",
"tenant":"acme2-max",
"created_at":"2024-08-01T18:07:58.099Z",
"ended_at":"2024-08-01T18:10:47.712Z",
"state":"succeeded"
}
Response parameters¶
A 200 OK response contains the following parameters.
Parameter |
Description |
---|---|
current_version |
A unique identifier that describes the configuration state of Amperity at the end of the workflow or at the time an error occurred. The value for this property is similar to: “etv-20240210-12345-6AbCDE”. |
ended_at |
The date and time at which a workflow ended. Note The amount of time that elapsed between created_at and ended_at is the runtime for the workflow. The length of time a workflow ran is visible from the Runtime box visible from the Type box on each individual workflow page. |
error |
A JSON array of values for a workflow error. Note An error message is shown for any workflow with a state of Failed. You can view the error message the from the Workflows page. The JSON array for an error is similar to: "error": {
"attribution": "customer",
"type": "amperity.workflow.task.stitch/table",
"message": "Found table in an invalid state:\n
loyalty_members. This error can be\n
resolved by removing this table\n
or by loading data to the table.",
"data": NULL,
},
where:
|
id |
The Amperity internal identifier for the workflow. For example wf-20240619-14418-6UhqSe. |
launched_version |
A unique identifier that describes the configuration state of Amperity at the start of the workflow. The value for this property is similar to: “etv-20240210-12345-6AbCDE”. |
name |
The name of the workflow. Note This is the same value that is visible from the title of each individual workflow page and from the Name column on the Workflows page. |
principal_email |
The email address for the user who started the workflow. |
principal_id |
A unique identifier for the Amperity user who started the workflow. For example: “google-apps|socktown@socktown.com”. |
principal_name |
The name of the Amperity user who started the workflow. For example: “Justin Scott” or “Automated workflow”. |
state |
The current state of the workflow. For example:
Note This is the same value that is visible from the Status box on each individual workflow page and from the Status column on the Workflows page. |
task_instances |
A JSON array that contains zero (or more) sets of the following parameters, one set for each task in the workflow. The list of parameters returned in the response may vary, depending on the type of task.
Note This is the same value that is visible from the Task column on each individual workflow page.
|
tenant |
The unique identifier for the tenant. |
type |
The type of workflow. Most workflows will have workflow types related to the following areas within Amperity:
Note This is the same value that is visible from the Type box on each individual workflow page and from the Type column on the Workflows page. |
warn_after_ms |
The length of time (in milliseconds) after which a warning is sent that notifies users that a workflow is running longer than expected. Note This parameter only applies to workflows that use SQL to write tables to storage. |