HTTP Router

Overview

Use this Snap to route documents to output views based on the incoming HTTP request method. This Snap is primarily meant for use in Pipelines executed through Triggered Tasks. The Snap matches the HTTP request method used in the Triggered Task and routes the document to the corresponding output view as configured for the request method.

Note:

The input data must contain the correct content-type header based on your use case, else your pipeline fails.



Snap views

View Description Examples of upstream and downstream Snaps
Input A document containing the data to be processed based on the incoming HTTP request.
Output If the input document is routed to more than one output views, they are all instances of the same input document. The Pipeline may fail if any downstream Snap attempts to modify the same document without copying it.
Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution Stops the current pipeline execution when an error occurs.
  • Discard Error Data and Continue Ignores the error, discards that record, and continues with the remaining records.
  • Route Error Data to Error View Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap settings

Legend:
  • Expression icon (): Allows using pipeline parameters to set field values dynamically (if enabled). SnapLogic Expressions are not supported. If disabled, you can provide a static value.
  • SnapGPT (): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
  • Suggestion icon (): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
  • Upload : Uploads files. Learn more.
Learn more about the icons in the Snap settings dialog.
Field / Field set Type Description
Label String

Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: HTTP Router

Example: HTTP Router
Routes Required. Use this field set to define/map one output view each to one or more of the request methods supported. Click Plus Icon to add a new row and define the values accordingly.
Request method String/Expression/ Suggestion
Select or enter one request method per row, depending on the different HTTP requests expected from the Triggered task. The following different request methods are supported:
  • GET
  • POST
  • PUT
  • PATCH
  • DELETE
  • HEAD

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

Example: GET

Output view name Dropdown list

Select an output view name from this dropdown 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 overview image is routed to output4 that corresponds to the value OTHER.

Tip:

Configure output views beforehand

Ensure that the required number of output views are added for the Snap from the Views tab. These output views will then be listed in this field for you to select.

Default value: N/A

Example: output3

Snap execution Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Validate and Execute

Example: Execute only

Troubleshooting

Error Reason Resolution
Failed to evaluate expression: _Request_Method. The expression for the Request Method field contains an invalid pipeline parameter and the Snap cannot process the incoming requests. Ensure you use the correct spelling for pipeline parameters within the expressions defined in Snap's settings.
If your data contains invalid content-type headers or if you pass an incorrect JSON payload, the Snap aborts the pipeline with an error. When the Snap receives an invalid content-type header in the input, the error appears at the platform level and therefore is not displayed in the Snap Settings dialogue box. Ensure to pass valid JSON Payload and content-type headers.

Examples: