Multipart Reader

In this article

Overview

You can use this Snap to split a MIME "multipart" binary stream into separate binary documents.  A multipart stream is typically generated by HTTP clients, such as web browsers, that need to transfer multiple blobs of data as a single message.

multipart-reader-overview.png

Snap Type

The Multipart Reader is a Transform-type Snap.

Support for Ultra Pipelines

Does not work in in Ultra Pipelines.

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input

Binary

  • Min: 1

  • Max: 1

  • JSON Parser

  • Excel Parser

Binary documents from a Snap with a binary output view or the input view can be left unlinked and used with a Triggered Task to accept POST/PUT requests.

Output

Binary

  • Min: 1

  • Max: 1

  • CSV Parser

  • File Writer

  • Binary to Document

The binary documents that made up the multipart stream. The headers for the binary output documents are taken from the headers in the parts themselves along with the header properties defined in this Snap.  If the binary input document is not a multipart stream, it is passed to the output view without processing.

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:

  • Stop Pipeline Execution: Stops the current pipeline execution if the Snap encounters an error.

  • 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

Field

Field Type

Description

Field

Field Type

Description

Label*


Default Value: Multipart Reader
Example: Multipart Reader

String

Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

Content-Type


Default Value: pipe.args.get('CONTENT_TYPE') || $.get('content-type')

String/Expression

Specify the value of the Content-Type header for the binary document.  The value of this header is needed to determine whether or not the binary document is, in fact, a multipart stream and what "boundary" is used to separate the parts of the stream. 

The default value for this property is an expression that fetches the content type from the pipeline parameters (as passed when invoked via a Triggered Task) or the binary input document header.

Binary Header Properties

 

 

The binary output document header can be modified by specifying properties in this table property.  The headers are initially populated with the headers from the parts in the stream. These properties allow you to pass values from the original multipart input document to the binary output documents.

Expression


Default Value: N/A

Expression

Specify the expression value to insert into the header. When evaluated, this expression, computes the value to insert.

Target Path


Default Value: N/A

String/Suggestion

Specify the JSON path where the value should be set in the header.

Snap execution


Default Value: Execute only
Example: Validate & Execute

 

Dropdown list

Select one of the following three modes in which the Snap executes:

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

Example


Post multiple files through the REST client

The following example pipeline demonstrates how to post multiple files using the Content type as Form data through the REST client:

ex-multipart-reader.png

Create a Triggered task for the specific Multipart Reader pipeline. It takes the cloud URL from the Manager and sends the REST pipeline request from the Postman client:

The Snap receives the request from the REST client and displays an output as a multipart output stream:

Three files are passed from the REST Client. These files are merged and displayed as a multipart output stream.

 

Snap Pack History