Execute workflows (former version - deprecated)
You can execute a workflow to trigger the chain of associated tasks and get the workflow result. It takes input parameters and returns a result.
API reference
Execute a workflow
To execute a workflow, you need to provide its ID and any requested input parameters. Each workflow has a specific set of parameters which have been defined during the workflow creation process.
The id of a workflow appears in the response of the query list workflow
So far, the list of parameters are not stored in the database. So, you need to refer to the customer specific documentation provided by the support team to properly fill in this information.
Query
curl --request POST 'https://api.wave.stream/workflows/{YOUR_WORKFLOW_ID}/execute' \
--header 'x-api-key: {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"param1": "value 1",
"param2": "value 2",
...
}'
API response
When a workflow is executed, the API starts an asynchronous job called "run" and immediately returns its information.
{
"appId": "2109031a772d090f92f1",
"id": "80b215ec-91a2-419f-88e2-d256aadf1e31",
"params": {
// The workflow execution params
},
"startedAt": "2023-01-27T07:54:25.126673557Z",
"status": "running",
"workflow": {
"appId": "2109031a772d090f92f1",
"createdAt": "2023-01-25T15:16:35.484854Z",
"description": "This is my first workflow",
"id": "8988f685-2b8c-4a09-9955-150426265d32",
"name": "My workflow",
"updatedAt": "2023-01-25T15:16:35.484854Z"
}
}
Get the run result
To retrieve the result of the run, you may use the polling method. To do so, fetch the run information on a regular basis (for example every 10 seconds) and check for its status. Stop polling (break the loop) if the status is not "running" anymore.
The status can take 3 values:
- running: The run is in progress (initial status)
- completed: The run is completed successfully
- failed: The run has failed
So far, the result format is not stored in the database. So, you need to refer to the customer specific documentation provided by the support team to properly extract this information.
Query
curl --request GET 'https://api.wave.stream/runs/{RUN_ID_FROM_THE_PREVIOUS_QUERY}' \
--header 'x-api-key: {YOUR_API_KEY}'
API response
{
"id": "80b215ec-91a2-419f-88e2-d256aadf1e31",
"result": {
"key1": "value 1",
"key2": "value 2"
},
"status": "completed"
// other attributes...
}