This document explains how to trigger a REST API from a job. The steps involved to set up the Rest API are
- Select the profile
- Select the time when you want to execute the job. The three options available are
- Execute now
- Execute on
- Repeat Schedule
- Select the Rest API Widget and fill in the details.
- You can also use the output of the API widget to trigger something else. In the following example, we use the resultant data to pass through a condition widget, and if the condition fails an email notification is triggered.
In RESTAPI for jobs, the main new feature is the exit criteria condition. It has two main options to terminate the executions.
1. Terminating Based On Exit Criteria Of Polling Interval and Timeout
- In this case, you can set up the polling interval and the time-out interval based on which the execution process will terminate.
- In the above example the API will iterate after every 10 seconds (Polling interval) and after 120 seconds (Timeout interval) the execution will terminate. You can then use the condition widget if you want to validate the resultant data and set up an email notification for the same.
2. Terminating Based On Exit Criteria Of Response Parameter
- In this case, the execution stops based on the response parameter that you have mentioned. Once the response parameter criteria are satisfied the execution stops irrespective of the polling interval and timeout criteria not being met.
- In the above example, the response parameter is set as ‘userid = 10’, so once the API reaches the data containing the userid as 10 the execution stops. You can then use the resultant data for executing some query chains too.
- In this example, the resultant data from the rest API is validated with the condition widget. If the condition is met, then we execute one query chain, and if the condition does not satisfy we execute another query chain.
Comments
0 comments
Please sign in to leave a comment.