HTTP Request Parameters in NetSuite SuiteScript 2026.1
Discover the new HTTP request parameters for SuiteScript in NetSuite 2026.1, enabling robust integration capabilities.
TL;DR Opening
Starting in NetSuite 2026.1, the HTTP request parameters have been enhanced in SuiteScript, allowing developers to specify detailed configurations such as method, URL, headers, and body for seamless integrations and better control over HTTP communications.
Overview of HTTP Request Parameters
NetSuite's SuiteScript allows for the execution of HTTP requests using the N/http module, which is fundamental for interactions with external APIs and services. This feature is particularly important for developers looking to build integrations within their NetSuite environment.
Key Features of HTTP Requests
- Support for Multiple HTTP Methods: The
options.methodparameter allows developers to select from various HTTP methods (GET, POST, PUT, DELETE) to conform to the requirements of the target API. - Customizable HTTP Headers: By utilizing the optional
options.headersparameter, developers can define custom headers for their requests, which can be vital for authentication or specifying content types. - Configurable Request Body: For methods like POST, PUT, and PATCH, the optional
options.bodyparameter enables developers to send data along with their requests. - Error Handling: The system provides specific error codes such as
SSS_INVALID_HOST_CERTandSSS_INVALID_URL, helping developers quickly diagnose issues related to untrusted certificates or malformed URLs. - Governance Limitations: Each HTTP request consumes 10 governance units, impacting your overall governance budget, which developers should account for in their scripts.
Parameters Description
| Parameter | Type | Required/Optional | Description |
|---|---|---|---|
options.method | enum | Required | Specifies the HTTP request method; set using http.Method. |
options.url | string | Required | The HTTP URL of the API endpoint being accessed. |
options.body | string | Object | Optional; content sent with the request (support varies by method). |
options.headers | Object | Optional | HTTP headers like Authorization, Content-Type, etc. |
Timeout Details
- Connection Timeout: If a connection to the destination server does not establish within 5 seconds, it will timeout.
- Request Timeout: If the payload takes more than 45 seconds to send, the request will timeout, ensuring that scripts remain responsive.
Example Code Snippet
Here’s a basic example of how to construct an HTTP request:
var headerObj = {
name: 'Accept-Language',
value: 'en-us'
};
var response = http.request({
method: http.Method.GET,
url: 'http://www.example.com/api/data',
body: 'My REQUEST Data',
headers: headerObj
});
This code illustrates the use of the http.request method, which sends a GET request to an external API with a specified header.
Who This Affects
Roles Impacted:
- Developers: Those working extensively with APIs and integrations will find this feature enhances their ability to handle HTTP requests.
- Administrators: Required knowledge for setting up scripts that involve external API interactions.
Key Takeaways
- HTTP request parameters allow for detailed configurations in SuiteScript for effective API communication.
- Governance units are consumed per request, reminding developers to optimize usage.
- Error codes provide clarity on failures, aiding in quicker troubleshooting.
Frequently Asked Questions (4)
What HTTP methods are supported by the new HTTP request parameters in SuiteScript 2026.1?
How can developers handle errors related to HTTP requests in SuiteScript?
Are there any governance limitations associated with making HTTP requests in NetSuite SuiteScript?
What happens if the connection or request takes too long in SuiteScript 2026.1?
Weekly Update History (1)
Added information to the following methods and modules to clarify that they are not supported in unauthenticated client-side contexts N/http methods: http.request(options) http.get(options) http.post(options) http.put(options) http.delete(options) N/https methods: https.request(options) https.get(options) https.post(options) https.put(options) https.delete(options) N/url methods: url.resolveRecord(options) url.resolveScript(options) url.resolveTaskLink(options) N/query Module N/search Module N/dataset Module N/workbook Module
View Oracle DocsWas this article helpful?