HTTP PUT Request Error Handling in SuiteScript
Learn error handling for HTTP PUT requests in SuiteScript, including common codes and governance limits.
TL;DR Opening
This article covers error handling for HTTP PUT requests in SuiteScript, outlining common error codes, timeout behavior, and required parameters. Understanding these elements is crucial for developers to effectively manage HTTP requests and enhance script reliability.
What is an HTTP PUT Request in SuiteScript?
An HTTP PUT request in SuiteScript is used to send data to a specified resource on the web, primarily for updating information. The HTTP request mechanism is supported in both client and server scripts through the N/http module.
Method Description
When sending an HTTP PUT request using SuiteScript, keep in mind:
- Connection timeouts occur if the connection takes longer than 5 seconds.
- The request payload must be sent within 45 seconds, or the request will timeout.
- This method cannot be used in unauthenticated client-side contexts.
- Consult relevant resources for further details regarding outbound HTTPS in such contexts.
Potential Errors with HTTP PUT Requests
While implementing HTTP PUT requests, developers may encounter various errors. Here are some of the common error codes along with their messages:
| Error Code | Message | Thrown If |
|---|---|---|
SSS_INVALID_HOST_CERT | An untrusted, unsupported, or invalid certificate was found for this host. | The client and server could not negotiate the desired security level, or the domain name in the URL is incorrect. Verify the domain syntax. |
SSS_INVALID_URL | The URL must be a fully qualified HTTP/HTTPS URL. | An invalid URL is specified in the options.url parameter. |
SSS_MISSING_REQD_ARGUMENT | Missing a required argument: {param name}. | The options.body or options.url parameter is not specified. |
Required Parameters
To successfully execute an HTTP PUT request, the following parameters are necessary:
options.body: Required. This parameter takes astringorObjectdata type, representing the PUT data.options.url: Required. This parameter is astringand specifies the HTTP URL being requested.options.headers: Optional. An object that includes the HTTP headers.
Syntax Example
Below is a code sample demonstrating the syntax for a SuiteScript HTTP PUT request:
1// Add additional code2...3var headerObj = {4 name: 'Accept-Language',5 value: 'en-us'6};7var response = http.put({8 url: 'http://www.google.com',9 body: 'My PUT Data',10 headers: headerObj11});12...13// Add additional codeWho This Affects
- Developers: Those implementing RESTful services and HTTP calls within SuiteScript.
- Administrators: Individuals overseeing script deployment and functionality in NetSuite.
Key Takeaways
- HTTP PUT requests allow data updates to specified resources.
- Common errors include untrusted certificates and invalid URLs.
- Timeout settings require connection within 5 seconds and data payload within 45 seconds.
Frequently Asked Questions (4)
What are the common error codes for HTTP PUT requests in SuiteScript?
What timeout settings apply to HTTP PUT requests in SuiteScript?
What parameters are required to execute an HTTP PUT request using SuiteScript?
Can HTTP PUT requests in SuiteScript be used in unauthenticated client-side contexts?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
