Calling REST Web Service from Workflow |
Scroll |
How do I call a REST Web Service from a Workflow?
1. In this example, we will use the REST Call function to post new details from Thereforeā¢ on to the web service. Begin the process by creating a REST Call function within a workflow.
2. Set the request type (to either GET, POST, PUT, DELETE or PATCH depending on the instruction), in this example, we will use the POST type.
•In the resource URL field, macros can be used to create more flexibility in sending and receiving information to the web service. •If it is necessary to set parameters as part of the REST Call, these can be defined in the Parameters tab within the above dialog. |
3. Complete the details requires in the Authorization tab in order to authorize the application against the external system. In this example, we are using the OAuth (Authorization Code).
4. Then define any additional headers that are required from the call within the Header tab. Click the Add... button to define additional headers. In this example, we only require an 'Accept' header where we are asking the web service that we would like a json to be returned instead of an xml.
5. In the Body section, a structure needs to be defined for which the new document will be based. In this example. fields within the document can be populated by index data values.
6. In the Status Codes section, define the codes that indicate a successful outcome. If the call provides a successful outcome, then the workflow instance can be routed to the next task.
7. Then define the Response Handling information in order to arrange how current information is updated based on the response of the REST Call. In this example, the newly created document's "Bill Id" will be included in the index data of Thereforeā¢ (under InvoiceId and Invoice No).
Before processing a workflow, click the Test button to check that the REST Call Function can communicate with the web service's API for the defined actions. |
8. Once all the required information has been included, click OK. At this point, the actual workflow instance can be initiated.
REST calls were designed for making outgoing calls to 3rd party applications. Although itās possible to use REST calls to call the Therefore API, to solve advanced requirements, the feature is limited especially when working with index data information. |