Show/Hide Toolbars

Thereforeā„¢ Help

Tutorials > Solution Designer > Workflow

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.

 

sd_t_workflow_RESTCall_001a

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.

 

sd_t_workflow_RESTCall_002a

info

In the resource URL field, macros can be used to create more flexibility in sending and receiving information to the web service.

sd_t_workflow_RESTCall_003a

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).

 

sd_t_workflow_RESTCall_004a

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.

 

sd_t_workflow_RESTCall_005a

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.

 

sd_t_workflow_RESTCall_006a

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.

 

sd_t_workflow_RESTCall_007a

 

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).

 

sd_t_workflow_RESTCall_008a

info

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.

sd_t_workflow_RESTCall_009a

 

 

8. Once all the required information has been included, click OK. At this point, the actual workflow instance can be initiated.

 

sd_t_workflow_RESTCall_010a

info

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.

Ā© 2024 Therefore Corporation, all rights reserved.