Web Request Rule
A Web Request Rule allows you to send an HTTP request to a web service or application connection and process the response.
Use the Request tab to configure the request URI, request method, and appropriate request headers, and content body.
Use the Response tab to configure how to handle the response from the request.
To create a new web request rule:
- On the Rules page, select the arrow beside New and select Web request as your rule type.
- In the Create Web Request Rule dialog box, specify the Name and Description for your rule.
- Select either Web Service Connection or Application Connection.
- Select the web service or application connection that you want access.
- Click Create.
- On the Request tab, craft the content of the request.
- Append additional parameters as needed to the URI. You can add Laserfiche tokens that can be filled in by a workflow when running the rule.
- Select from one of the following HTTP request methods:
- Get
- Head
- Post
- Put
- Patch
- Delete
- Add HTTP request headers as required for the web service endpoint.
- For Post and Put requests, craft the content body.
- Use Test Web Request, to test the request works as you expect. The Response tab will display the response of the test.
- On the Request tab, craft the content of the request.
- On the Response tab, configure how to process the returned response. Add tokens that will be used by the processes using the response.
- If the Test Web Request automated data is unavailable or otherwise unsuitable for the following steps, you may build a manual response by clicking the edit response here link when an HTTP response type is selected. Provide a status message, response header, and response body in standard JSON response format.
- Select JSON from the Parse Type menu in the top right corner of the response window.
- To add output tokens containing information from the header:
- Click the + Add output token to create a new token within the HTTP Headers area.
- Provide a token name for use by the process that will receive the data.
- Select the header element from the dropdown
- To add output tokens containing information from the body of the response:
- Click the + Add output token to create a new token within the Response Body area.
- Provide a token name for use by the process that will receive the data.
- Create a JSONPath expression to retrieve the data desired. If the expression retrieves data from the sample response, a preview of the data will be displayed.
Note: The parser accepts a standard JSONPath expression that uses dot-notation. For example,
$.store.book[0].title
- Add a Run Web Request Rule or a Rules Service Task activity to your processes.
Note: Tokens may contain either single or multi-value return values.
Note: Publish the rule to make it available for use in process automation workflows.
Content Body Considerations
-
For Post, Put, and Patch requests, craft the content body.
-
For File_Upload requests, select Content Type as [multipart/form-data] and craft the multipart content body.
Note: The default file content encoding is base64 string. To upload the file under binary encoding you must add
Content-Transfer-Encoding: binary
Example
--aaa
Content-Disposition: form-data; name="%(Name: FileName; Type: Text)"; filename="%(Name: FileName; Type: Text)"
Content-Type: application/pdf
Content-Transfer-Encoding: binary
%(Name: InvoiceFile; Type: File)
--aaa-- -
Click Test Web Request to ensure the request works as you expect. The Response tab will display the response of the test.