Workflow Tasks in an API Flow¶
An API flow orchestration allows the usage of various workflow tasks. These include tasks like Send Mail, System File Actions, Run Exe Programs, Run Flow tasks, FTP tasks, etc, which can be utilized in accordance with the API action.
Inside the toolbox, the Workflow Tasks tab lists all the available tasks that can be used when designing an API flow.
For our use case, we have designed an API flow for the ‘Get Product by name’ endpoint.
As you can see in the flow above, two Send Mail workflow tasks have been used. Once a request is received with the product name, it is sent as an input to the Database Lookup object to fetch a matching record. It is then passed through a Route Transformation which routes the data to send a confirmation mail for a successful match or a ‘Not Found’ mail notification otherwise.
The user will either receive a mail that says the item is available or a mail that states that the item is unavailable, and the API will return the respective responses.
Note: If no data mappings are available to orchestrate the flow, as in this case when using a Send Mail object, the user can make use of Anchor Maps to control the flow.
To learn more about how Anchor Maps are used, please refer to the respective document here.
Similarly, here is another way we have used workflow tasks within an API flow,
Instead of using the DB Lookup and Route Transformation object, the entire process has been replaced with a Run Dataflow object that can run any ETL pipeline.
The dataflow which will be triggered in the API is doing the same work as the previous API flow. However, it is now less cluttered.
This concludes the functionality of Workflow tasks in an API flow.