Workflow¶
Endpoints
A workflow is a collection of digital workers linked together to perform tasks in an automated fashion. Workflows can incorporate portfolios, datastores, report templates, API, and email distributions, as well as standard and custom digital workers.
The workflow object¶
What a workflow object looks like?
{
"status": "OK",
"updated": 1624633670,
"description": "This is my first workflow. #first #new #workflow",
"tags": ["first", "new", "workflow"],
"trigger_enabled": true,
"gui": {
"offset_x": 0,
"zoom": 75,
"offset_y": 0
},
"created": 1624633670,
"starter_worker_id": "wrkr_aVFPQTerHF2JaO0hILbp959v7",
"workspace": "main",
"trigger_type": "MANUAL",
"trigger_config": {},
"id": "wrkf_8fRueOt4JlXV9k5o9HZDMWfw7",
"name": "My First Workflow"
}
| Property | Description |
|---|---|
id string |
Unique identifier (UID) for the workflow. |
created timestamp |
Time at which the object was created. Measured in seconds since the Unix epoch. |
updated timestamp |
Time at which the object was updated. Measured in seconds since the Unix epoch. |
name string |
The workflow's name. |
description string |
An arbitrary string attached to the workflow. Often useful for finding detailed information about the workflow or for filtering a search based on the present hashtags. |
tags array |
Sequence of hashtags used to find the related workflow. The more hashtags that are used, the more elements that are filtered out from the search. Labels, dates and any other hashtag can be used. |
version string |
Indicates the workflow's current version. |
trigger_type string |
The type of the workflow's trigger. It can be Manual, API, Time-Based or Integration File Received. |
trigger_config object |
Parameters used to activate the workflow's trigger. |
workspace string |
The workspace where the workflow was generated. |
List all workflows¶
To list all workflows, run the following:
The above call returns the following JSON object:
{
"workflows": [
{
"status": "OK",
"updated": 1624633670,
"description": "This is my first workflow. #first #new #workflow",
"tags": [
"first",
"new",
"workflow"
],
"trigger_enabled": true,
"gui": {
"offset_x": 0,
"zoom": 75,
"offset_y": 0
},
"created": 1624633670,
"starter_worker_id": "wrkr_aVFPQTerHF2JaO0hILbp959v7",
"workspace": "main",
"trigger_type": "MANUAL",
"trigger_config": {},
"id": "wrkf_8fRueOt4JlXV9k5o9HZDMWfw7",
"name": "My First Workflow"
},
...
],
"next_page_token": null
}
Returns a list of workflows you’ve previously created. The workflows are returned in sorted order, with the most recent workflow appearing first.
HTTP Request
GET /workflows
HTTP Parameters
| Parameter | Description |
|---|---|
query string |
optional, default is null Request a list of workflows filtering it by name or tag. When using a tag to perform a query, each term must include a hashtag prefix. (e.g: query="#april #sample") |
workspace string |
optional, default is main Determines on which workspace the request will be made. |
page_size integer |
optional, default is 10 Set the number of objects that will be listed per page. |
page_token integer |
optional, default is null The token defines which page will be returned to the user. For further information, please check out our pagination guide. |
Retrieve a workflow¶
Retrieves the details of an existing workflow by supplying the workflow's id.
To retrieve a workflow, run the following:
The above call returns the following JSON object:
{
"workflow": {
"status": "OK",
"updated": 1624309266,
"description": "This is my first workflow. #first #new #workflow",
"tags": [
"first",
"new",
"workflow"
],
"trigger_enabled": true,
"workers": [
...
],
"created": 1624309074,
"starter_worker_id": "wrkr_jcQBp4Hj2MX3l9xsk8wgAByi7",
"workspace": "main",
"id": "wrkf_uylMWijKauV4B4Te7UJg9cNIv",
"trigger_type": "MANUAL",
"trigger_config": {},
"gui": {
"offset_x": 0,
"zoom": 75,
"offset_y": 0
},
"name": "My First Workflow"
}
}
HTTP Request
GET /workflows/:id
HTTP Parameters
| Parameter | Description |
|---|---|
id string |
REQUIRED A unique identifier (UID) for a workflow. A workflow's id will always look like this: wrkf_uylMWijKauV4B4Te7UJg9cNIv. |
workspace string |
optional, default is main Determines on which workspace the request will be made. |
Run a workflow¶
Runs a specific workflow through the api. On this example we are running a workflow that contains a File Generator worker.
Running a workflow is always asynchronous. This endpoint responds with HTTP 202 Accepted, never 200 OK: the request has been accepted and the workflow execution has been started/queued, but the workflow has not necessarily finished running yet. The response contains a workflow_execution object; keep its id.
Getting the result of a run takes four steps:
- Run. Send this request. Keep
workflow_execution.id. - Wait. Poll Retrieve a workflow execution every
poll_intervalseconds (default2) untilrun_statusisSUCCEEDED,FAILEDorCANCELED. Stop with an error aftertimeoutseconds (default300). A workflow that stops before it finishes, or a failure in a worker that is not the Ender, leavesrun_statusatRUNNINGforever, so the timeout is mandatory. - Judge. Treat
run_status == SUCCEEDEDas the only success.FAILEDis a failure.CANCELEDis reserved and is also a failure. - Read. Fetch the Ender's worker execution with
with_result=true. The business output isworker_execution.result.
See Polling for a workflow execution's completion for the full loop.
To run a workflow, run the following:
curl https://api.everysk.com/v2/workflows/wrkf_P95OLO61oGM5NwFn3W4iMl7rs/run \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"parameters": {
"file": {
"name": "SimpleTextFile.txt",
"content_type": "text/plain",
"data": "SGVsbG8gV29ybGQ="
}
},
"workspace": "main"
}' \
-X POST
The above call returns the following JSON object:
{
"workflow_execution": {
"id": "wfex_T1eYymTSIptJ4Hyt1Z6p4uGOe",
"run_status": "RUNNING",
"workflow_id": "wrkf_P95OLO61oGM5NwFn3W4iMl7rs",
"workflow_name": "File Generator Workflow",
"trigger": "API",
"workspace": "main",
"started_worker_id": "wrkr_Sut4ZTaePs4PkdjDliVWYseGD",
"ender_worker_id": "wrkr_aVFPQTerHF2JaO0hILbp959v7",
"ender_worker_execution_id": null,
"created": 1632835285,
"updated": 1632835285,
"started": 1632835285,
"duration": null,
"real_execution_time": null,
"total_execution_time": null,
"resume": null
}
}
HTTP Request
POST /workflows/:id/run
HTTP Parameters
| Parameter | Description |
|---|---|
id string |
REQUIRED The workflow's unique indetifier. |
workspace string |
optional, default is main Determines on which workspace the request will be made. |
parameters object |
REQUIRED Object sent to be used inside the workflow that will be started through the API. Usually this object contains information and data required by the workers inside the workflow in order to execute properly. If the workers inside the target workflow do not require external inputs you can pass a empty object as parameter. In Python it must be used as kwargs. |
Delete a workflow¶
Permanently deletes a workflow. It cannot be undone. Returns an object with the workflow's id and an attribute specifying whether the workflow was successfully deleted or not.
To delete a workflow, run the following:
The above call returns the following JSON object:
{
"workflow": {
"deleted": true,
"id": "wrkf_uylMWijKauV4B4Te7UJg9cNIv",
"name": "My First Workflow"
}
}
HTTP Request
DELETE /workflows/:id
HTTP Parameters
| Parameter | Description |
|---|---|
id string |
REQUIRED The workflow's unique indetifier. |
workspace string |
optional, default is main Determines on which workspace the request will be made. |