On this Page
Table of Contents | ||||
---|---|---|---|---|
|
Snap type: | Transform | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: | This Snap converts the value of the "content" key in the input document to a binary data at the output view.
| |||||||||||||
Prerequisites: | [None] | |||||||||||||
Support and limitations: | Works in Ultra Task Pipelines. | |||||||||||||
Account: | Accounts are not used with this Snap. | |||||||||||||
Views: |
| |||||||||||||
Settings | ||||||||||||||
Label | Required. 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. | |||||||||||||
Encode or Decode | Required. Select if the content should be Base64 encoded or Base64 decoded or none (BYTE_ARRAY). The options are:
If the input "content" data has already been Base64-encoded and ENCODE_BASE64 is selected, the Snap will not encode the content again. In the same way, if the input "content" data has not been Base64-encoded and DECODE_BASE64 is selected, the Snap will not attempt to decode the content. The format option DOCUMENT allows you to serialize the document into a SnapLogic-specific JSON represenation, which allows you to deserialize types such as Dates when read back using a BinaryToDocument Snap. BYTE_ARRAY is used to pass raw binary data. For example, a compressed .zip file can be created in many formats. The safest way to convert such a file between binary and document is with BYTE_ARRAY. When NONE is selected, the Snaplex's default platform specific encoding is used.This can be used for string text such as a .xml or a .csv format. Because this uses platform specific encoding, it can vary between Snaplexes; therefore it is not advised to use NONE when passing data between pipelines that may be running in Snaplexes which run different operating systems.
| |||||||||||||
Binary header properties | Specifies the properties to add to the binary document's header. Click + to add a binary header.
Example: Status can be specified using the Snap Header properties. Default value: None | |||||||||||||
Expression | The value to use for a property in the binary header. Default value: None | |||||||||||||
Target Path | Enter the target JSON path where the value from the expression will be written. Example: $['content-location'] to write the property 'content-location'. Default value: None | |||||||||||||
|
|
Examples
Downloading a PDF File Attached to a Salesforce Account Record
To download a PDF file attached to a Salesforce Account record, prepare a pipeline of Salesforce Attachment Download Snap + Document to Binary Snap + File Writer Snap.
- Salesforce Attachment Download Snap: Enter an Attachment ID.
- Binary to Document Snap: Select "[BYTE_ARRAY]" for the Encode or Decode property. (Salesforce Attachment Download Snap provides Base64-decoded content data.)
- File Writer Snap: Enter the output file URL in the File name property.
The following pipeline reads the data in a .json format, encodes the data into a binary format and then decodes the data into output view.
The File Reader Snap reads the JSON data to be encoded to a binary format:
The Binary to Document encodes the data from the input stream, the respective output preview as displayed below:
The Document to Binary Snap decodes the data into an output preview as displayed below:
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|