In this article
...
Input/Output | Type of View | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
|
| An HTTP request. |
Output | Document |
|
| An HTTP response. |
...
Parameter Name | Data Type | Description | Default Value | Example | ||
---|---|---|---|---|---|---|
Label | String | Required. The name for the Snap. You can modify the default name to be more specific and meaningful, especially if you have more than one of the same Snaps in your Pipeline. | NetSuite Call RESTlet | RESTlet GET | ||
HTTP Method | Drop-down list | Required. Select the HTTP method to call the RESTlet. The available options are:
| GET | POST | ||
Script ID | String/Integer | Required. Specify the ID of the RESTlet script.
| N/A | customscript8 8 | ||
Deploy ID | String/Integer | Required. Specify the ID of the RESTlet deployment. | N/A | customdeploy2 2 | ||
Content | String/Suggestion | Activates when you select POST or PUT for HTTP Method. Specify the path of the content for the body of a POST or PUT request. | $ | $update | ||
Query Parameters | Activates when you select GET or DELETE for HTTP Method. Use this field set to add query parameters to the request URL. This field set contains the following fields:
| |||||
Key | String/Expression | Enter the parameter key. | N/A | City | ||
Value | String/Expression | Enter the parameter value for the corresponding key. | N/A | Hyderabad | ||
Has Next | String/Expression | Specify the expression that must be evaluated to true or false on the output document to determine whether more results are available. If the expression evaluates to true, the query parameters for the next request are updated using the values provided in the Query Parameters for Next field.
| N/A | parseInt($response.content.page) < 5 | ||
Query Parameters for Next | Activates when you provide an expression for Has Next. Use this field set to add query parameters to the request URL. This field set contains the following fields:
| |||||
MIME Type | Drop-down list | Choose the MIME type for the content-type header of the request and response. The available options are:
| application/json | application/xml | ||
Maximum request attempts | Integer/Expression | Specify the maximum number of requests to attempt in case of failure. | 3 | 4 | ||
Retry request interval | Integer/Expression | Specify the interval between two successive requests. A retry happens only when the previous attempt resulted in an exception. | 2 | 3 | ||
Snap Execution | Drop-down list | Select one of the three modes in which the Snap executes:
| Validate & Execute | Execute only |
...
Multiexcerpt include macro | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Examples
Calling a RESTlet Using the GET method
The following example Pipeline demonstrates how you can call a customscriptecho RESTlet using the GET method and query parameters. We use the Mapper and NetSuite Call RESTlet Snaps in this example.
First, we configure the Mapper Snap to pass inputs to the NetSuite Call RESTlet Snap as follows.
Then, we configure the NetSuite Call RESTlet Snap to perform a GET operation and get the desired response in the body.
Upon validation, the output displays the response as follows.
Calling a RESTlet Using the POST method
The following example Pipeline demonstrates how you can execute a POST request using the POST method. We use the JSON Generator and NetSuite Call RESTlet Snaps in this example.
Snap Configuration | Snap Output |
---|---|
First, we configure the JSON Generator Snap to pass inputs to the NetSuite Call RESTlet Snap.
Then, we configure the NetSuite Call RESTlet Snap to perform a POST operation. Note that the Content field is activated by default for the POST method to pass the response as a body. We set the Content field to $update to select a subset of the input document.
Upon validation, the output document includes the subset of objects for request, information, response and original.
Creating a RESTlet using the GET method to perform multiple GET requests to retrieve five pages
...