In this article
Overview
You can use the REST Put Snap to replace business object resources. If the business object does not exist, the Snap creates the object.
Prerequisites
None.
Supported Features
Works in Ultra Task Pipelines. We recommend you to set the batch size to 1.
Limitations and Known Issues
None.
Snap Views
Views | View Type | View Format | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
|
| Each input document contains details associated with the data that must be replaced or created in the target RESTful server. |
Output | Document |
|
| Each output document contains details related to the business objects impacted as a result of Snap execution. |
Error | If the Snap fails during the operation, the Snap sends an error document to the error view containing the fields error, reason, resolution, and stacktrace. For this to happen, however, the Error view must be enabled. |
Snap Settings
Field Name | Field Type | Description | ||||
---|---|---|---|---|---|---|
Label* | String | Specify a 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. | ||||
Service URL* | String/Expression | Macro lookup error: excerpt "REST_Serviceurl" was not found on page "REST Get" (with ID 1438830) in space "SD". If you're experiencing issues please see our Troubleshooting Guide. Macro lookup error: excerpt "Serviceurl_Example" was not found on page "REST Get" (with ID 1438830) in space "SD". If you're experiencing issues please see our Troubleshooting Guide.
The Service URL for a REST snap has to be valid. If the Service URL contains any special characters, such as !, =, %21, $, and ^, the Snap throws an exception error. You can escape the special characters (using expression language) using one of the following methods:
We recommend you to use the former (encodeURIComponent) method to escape the special characters. | ||||
HTTP Entity | String/Expression | Enter the JSON path to the HTTP entity data in the input Map data, or leave this field empty if there is no entity data to send to the service URL. | ||||
Batch size | String | Specify the batch size of the request. The incoming documents will be accumulated in a list up to the defined batch size before it is submitted to the endpoint. You must only set this if your REST endpoint expects a list. | ||||
Show all headers | Checkbox | Select this checkbox to display the response header values as a list of objects in the output document. If any of these objects is a string in format "key1=value1; key2=value2; ...", it is parsed into a map data. The REST endpoint might return HTTP response with multiple headers with same header name. Default Value: Not selected | ||||
Upload transfer request type | Dropdown list | Choose the type of encoding that you want to use to safely transfer the entity to the user. The available options are:
Default Value: Chunked transfer encoding | ||||
Form Upload | Use this field set to configure the fields required to upload multiple files and text. Learn more about Multipart Upload.
Multiple file upload settings work similarly across the REST Post, Patch, and Put Snaps. To see an example of these settings in action, see Uploading Multiple Documents Using the REST Post Snap | |||||
Multipart Type | Dropdown list | Choose the type of multipart upload that you want to initiate. The available options are:
Default Value: FILE | ||||
Multipart Key | String/Expression | Enter the key for the multi-part form-data needed to upload a file. HTTP POST uses multi-part entity to achieve the file upload. The form-data of its multi-part entity contains key-value pairs. Upload-file key is dependent on the service endpoint. Multipart Key can be anything and it depends on the service endpoint. Default Value: N/A Example: file This property is expression-enabled. For more information on the expression language, see Understanding Expressions in SnapLogic and Using Expressions. For information on Pipeline Parameters, see Pipeline Properties. | ||||
Multipart Value | String/Expression | Specify the the file or text to be uploaded. If Multipart Type is FILE, the following are applicable:
If Multipart Type is a TEXT, then
For Text part upload using Form Upload, the Http Entity and Filename to be used are ignored. Default Value: N/A
| ||||
Filename to be used | String/Expression | Enter the filename to be used for the new file created by the Snap. Example: file.csv | ||||
Multipart Content-Type | String/Expression/Suggestion | Select the content type headers for the data in the body of the multipart HTTP request. The available options are:
If the Multipart Type is TEXT, it is generally not required to specify any value in this field. When you do not specify any value, the API uses the default value
Default Value: N/A | ||||
Trust all certificates | Checkbox | Select this checkbox to trust all certificates, such as self-signed certificates. Default Value: Deselected | ||||
Follow redirects* | Checkbox | Select this checkbox to follow HTTP redirects. Default value: Selected When not selected, another request will not be made and the 301/302 response will show up in the output view. | ||||
Query parameters | Use this field set to define query parameters. This is optional and can either be defined directly in the service URL, as separate parameters or both. An example for OAuth2 (LinkedIn enabled endpoint). This field set contains the Query parameter and Query parameter value fields. | |||||
Query parameter | String/Expression | Specify the name for the query parameter. Default Value: N/A | ||||
Query parameter value | String | Specify the value that you want to assign to the parameter. Default Value: N/A | ||||
HTTP header | Use this field set to specify the HTTP header key-value pairs. This field set contains the Key and Value fields. | |||||
Key | String/Expression | Enter the key for HTTP header. Default Value: N/A | ||||
Value | String/Expression | Enter the value for the key parameter. Default Value: N/A | ||||
Response entity type | Dropdown list | Choose the response entity type in the output document. The available options include:
If TEXT or BINARY is selected, the Snap will not attempt to parse the entity content. If DEFAULT is selected, the Snap produces the expected result in most cases, but when failed to do so, users may set the Response entity type to TEXT or BINARY. Default value: DEFAULT | ||||
Cookie Policy | Dropdown list | Select a Cookie Policy from the following options:
When using a cookie policy, you must select Show All Headers checkbox to view the parsed cookies from the cookie policy specification. Default Value: Ignore Cookies | ||||
Read timeout | Integer | Specify the time in seconds to wait before aborting the request due to a failure to read from the target service. This option lets you specify a timeout value in seconds after which the request gets aborted. Default value: 900 seconds
| ||||
Connection timeout | Integer | Specify the time in seconds to wait before aborting the request due to a failure to establish a connection to the target service. Default Value: 30 | ||||
Maximum request attempts | Integer | Specify the maximum number of attempts to be made to receive a response. The request is terminated if the attempts do not result in a response. Default Value: 5 | ||||
Retry request interval | Integer | Specify the interval (in seconds) between two successive requests. A retry happens only when the previous attempt failed. Default Value: 3 | ||||
Retry Policy | Dropdown list | Choose the retry policy for connection and error responses. The available options are:
Default Value: Connection errors | ||||
Normalize URL | Checkbox | Select this checkbox to normalize the Service URL. This enables the Snap to convert double slashes (//) in the URL path to single slash (/). For example, https://example.com/path//to//file is converted to https://example.com/path/to/file. Deselecting this check box reverts the Snap to 4.19 Snaplex behavior, wherein the URL paths were not normalized by default. In the 4.20 Release, due to the HTTP client upgrade the URL paths were normalized by default. Hence, there was a change in behavior in handling the URL paths in 4.20 release when compared to 4.19. This change in behavior should not impact the existing Pipelines, because most of the websites map URL paths with double or single slashes to the same endpoint. For example, https://snaplogic.com/company/diversity and https://snaplogic.com//company//diversity direct to the same endpoint. Therefore, we recommend you to select the Normalize URL checkbox. However, an exception to this is when you use non-standard URLs that differentiate the URL paths containing double slashes from those with single slashes and map them to different endpoints, in which case you must deselect Normalize URL check box. Default Value: Selected | ||||
Snap Execution | Dropdown list | Select one of the three modes in which the Snap executes. Available options are:
Default value: Execute only |
Troubleshooting
Error | Reason | Resolution |
---|---|---|
Failed to execute HTTP request | The Service URL must have a protocol, such as http://, https://. | Please check the Snap properties. Specifically, check your entry in the Service URL field. |
<Service_URL>: Name or service not known. This basically means that the service URL you entered is not accessible. | ||
Failure: Validation errors: property_map.settings.serviceUrl.value: Could not compile expression: <Service_URL> | The snap settings are not correct. Encountered extraneous input ':' at line 1:5; expecting={<EOF>, '||', '&&', '^', '==', '!=', '>', '<', '>=', '<=', '+', '-', '*', '/', '%', '?', 'instanceof', 'in', 'matches', '[', '(', '.', PropertyRef}. This means that you have turned expressions on () while entering string value into the Service URL field. | Please fix the snap configuration and try the execution again. Please check expression syntax. Specifically, ensure that your service URL is a proper expression; or turn off the expression control (). For more information on the expression language, see Understanding Expressions in SnapLogic and Using Expressions. |
HTTP entity: <string_in_HTTP entity field> is undefined. Perhaps you meant: <List of variables received from the upstream Snap>. | Either there is an error in the value in the HTTP entity field, or you have used string input while having expressions enabled. | Check the spelling of the variable. Also, check whether your HTTP entity entry requires expressions. Update Snap settings as appropriate. |
REST API service endpoint returned error result: status code = 400 | Reason phrase = BAD REQUEST, refer to the error_entity field in the error view document for more details. You typically see this message when:
| Check the values of Snap properties. Specifically:
|
File not found: <File URL> | File not found on <server URL> at <complete address of file to be uploaded> | Address the reported issue. Check the location of the file to be uploaded. |
Single file upload: <Name of field>: <name of file> is undefined. Perhaps you meant: <options based on your input> | null | Check the spelling of the variable. Specifically, check whether the expressions toggle is turned on even though it is not required. |
REST API service endpoint returned error result: status code = 409 | CONFLICT, refer to the error_entity field in the error view document for more details. This happens when you already have the resource that you want to create in the target endpoint. | Check the values of Snap properties. |
URL Parse Exception - 403 | The Service URL path might be containing any of the following special characters: !, =, %, #, $, ^&()_¢äâêîôûñç¡¿ÉÙËǨ°¸ðø©¢¾A+²½µ®§÷¶þ | To escape the special characters, use the global function encodeURIComponent on any variables that might contain special characters so that they are encoded properly. |
Too many Requests - 429 | There are too many requests to REST endpoint. | Wait for the retry to succeed. Rest related Snaps extract the response header and automatically retry when they encounter status 429. By default, the retry interval (Retry-After) is specified in the HTTP response header. If no value is available for Retry-After, then the Snap’s Retry Interval value is used. |
Examples
Adding Members to SnapLogic Groups
In this example, we add members to a SnapLogic group.
We design the Pipeline as shown below:
We configure the JSON Generator Snap to enter details associated with the member that you want to add to the target group.
We configure the REST Put Snap, enter the account details in the Account tab, and configure the Snap to send the REST request to the endpoint.
- We enter the service URL associated with the group in which you want to add the member. For information on creating the service URL, see Update Member List.
- We specify a header to the call, indicating that the "Content-Type" in the body of your REST call is "application/JSON".
We save and execute the Pipeline. Once the Pipeline completes executing, the REST Put Snaps displays details associated with the operation performed.
Downloads
Important steps to successfully reuse Pipelines
- Download and import the pipeline into the SnapLogic application.
- Configure Snap accounts as applicable.
- Provide pipeline parameters as applicable.