In this article
Table of Contents | ||||
---|---|---|---|---|
|
...
Info |
---|
|
...
Field Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Label | String |
Default Value: N/A Example: HTTP Router | |||||||||
Routes* | Use this field set to define/map one output view each to one or more of the request methods supported. Only one method can be specified in each row. Click to add a new row in this table and define the values accordingly. This field set comprises of the following fields:
| ||||||||||
Request method | String/Expression/ Suggestion | Select or enter one request method, per each row, depending on the different HTTP requests expected from the Triggered task. The following different request methods are supported:
This field allows an additional value OTHER to handle request methods coming from the Triggered Task that are not configured in this Snap. Default Value: N/A | |||||||||
Output view name | Dropdown list | Select an output view name from this drop-down list for each Request method selected. Map the value OTHER to an output view that suits your exception handling requirements. For example, an incoming request method DELETE or HEAD in the above scenario (image) is routed to output4 that corresponds to the value OTHER.
Default Value: N/A | |||||||||
Snap Execution | Dropdown list | Select one of the three following modes in which the Snap executes:
Default Value: Validate & Execute |
Troubleshooting
Error | Reason | Resolution |
---|---|---|
Failed to evaluate expression: _Reqest_Method. | The expression for the Request Method field contains an invalid Pipeline parameter and the Snap is unable to process the incoming requests. | Ensure that you use the correct spelling for Pipeline parameters within the expressions defined in Snap's settings. |
Examples
Using HTTP Router Snap to Process the Request from a Triggered Task
...
In this example, the HTTP Router uses this JSON document and the REQUEST_METHOD from the Triggered Task as inputs. Based on the incoming value for REQUEST_METHOD (POST in this example), the HTTP Router routes the document to the corresponding output view (output1 in the validated Pipeline above). The Pipeline execution continues further to finally write the formatted JSON output into a JSON file.
Using HTTP Router Snap to Process an Ultra Task
The following example Pipeline demonstrates how you can use an HTTP Router Snap to process an incoming PATCH request through an Ultra Task.
First, we create an Ultra Task for the HTTP Router Pipeline with a request to send a notification to the patchadmin@snaplogic.com whenever a patch is completed.
Ultra Task for HTTP Router Snap | Pipeline with HTTP Router Snap |
---|---|
We configure the HTTP Router Snap to route incoming data to the corresponding view.
When the Ultra Task - Ultra_Task_On_HTTP_Router is run, the corresponding Pipeline - HTTP Router is executed. Based on the HTTP method, the HTTP router routes the data to the corresponding output view (in this example, the patch request routes to output 4). You can further write the formatted JSON output into a JSON file using the File Writer Snap.
Downloads
Multiexcerpt include macro | ||||
---|---|---|---|---|
|
...