The Everysk API allows to run workflows outside the Everysk Plaftorm. To do so, first you have to change the starter worker trigger type to API (learn more about the starter worker here).
Then you must get your workflow id. You can find it by clicking on the icon besides your workflow's name on the workflows page. It will automatically copy the id to your clipboard.
The following code examples will be able to run our simple workflow. In order to run more complex workflows check the Everysk API documentation.
Python Example
import everysk
import json
everysk.api_sid = 'YOUR_API_SID'
everysk.api_token = 'YOUR_API_TOKEN'
params = {}
response = everysk.Workflow.run('YOUR_WORKFLOW_ID', workspace='main', **params)
print(json.dumps(response, indent=2))
Now run the python code on a command prompt.
$ python run_workflow.py
CURL Example
curl https://api.everysk.com/v2/workflows/YOUR_WORKFLOW_ID/run \
-H "Content-Type: application/json" \
-u YOUR_ACCOUNT_SID:YOUR_AUTH_TOKEN
-d '{
"parameters":{},
"workspace": "main"
}'
-X POST
Response
Both examples will return the following response:
{
"workflow_execution": {
"status": "OK",
"started_worker_id": "wrkr_WjKGu5wCMgUEVn1sEr9S1137w",
"workflow_id": "wrkf_RhNBYS32y9jFlfgiIU74OskWL",
"version": "v1",
"created": 1634749285,
"started": null,
"trigger": "API",
"workflow_name": "New Workflow",
"id": "wfex_V9lzF7epdIQFqoPYXEltfxGaX",
"started_worker_name": "Starter"
}
}
Now go inside the workflow and click on the Executions button on the bottom. It will open a section containing information about the workflow execution, which means the workflow was executed successfully.