HTTP PUT Request Syntax in SuiteScript 2.x
Learn the syntax for HTTP PUT requests in SuiteScript 2.x, including parameters and common errors.
TL;DR Opening
This article explains how to execute an HTTP PUT request using SuiteScript 2.x, focusing on the syntax, parameters, and potential errors to be aware of in your scripting.
Method Description
The HTTP PUT request method allows you to send data to a specific URL. However, it has some important timeout limitations:
- Connection timeout: 5 seconds
- Data sending timeout: 45 seconds
Note that the PUT request is not functional in unauthenticated client-side contexts, which is crucial for ensuring secure interactions. For further information, refer to the relevant documentation on HTTP requests.
Returns
The PUT request method returns either a http.ClientResponse or http.ServerResponse.
Supported Script Types
- Client Scripts
- Server Scripts
For additional details, check out the SuiteScript 2.x Script Types.
Governance
Using the HTTP PUT method consumes 10 governance units.
Parameters
The options parameter is a JavaScript object containing several key properties:
| Parameter | Type | Required / Optional | Description |
|---|---|---|---|
options.body | string Object | Required | The data payload sent with the request. |
options.url | string | Required | The HTTP URL to which the request is sent. |
options.headers | Object | Optional | Custom headers for the request. |
Errors
Here are the common error codes you might encounter when performing a PUT request:
| Error Code | Message | Thrown If |
|---|---|---|
SSS_INVALID_HOST_CERT | An untrusted, unsupported, or invalid certificate was found for this host. | Security negotiation fails or domain issues. |
SSS_INVALID_URL | The URL must be a fully qualified HTTP/HTTPS URL. | Invalid URL specified in options.url. |
SSS_MISSING_REQD_ARGUMENT | Missing a required argument: {param name} | options.body or options.url not specified. |
Example Syntax
Below is a code sample illustrating the syntax used for the HTTP PUT request, although it is not a complete functional example:
1// Add additional code 2...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 codeRelated Topics
- N/http Module
- SuiteScript 2.x Modules
- SuiteScript 2.x
Key Takeaways
- The HTTP PUT method is critical for sending data to specified URLs.
- Timeout settings can affect request success; understand these limitations.
- Ensure all required parameters are included to avoid common errors.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
What script types support HTTP PUT requests in SuiteScript 2.x?
What are the required parameters for executing an HTTP PUT request in SuiteScript 2.x?
What happens if I use an invalid URL in an HTTP PUT request?
What are the timeout limitations for HTTP PUT requests in SuiteScript 2.x?
Was this article helpful?
More in Integration
- Natural Language Queries in NetSuite AI
MCP Standard Tools SuiteApp enables AI-driven data tasks in NetSuite, aligned with role permissions.
- Square Connector Integration in NetSuite 2026.1
Discover the Square Connector for seamless integration with NetSuite 2026.1, synchronizing transactions, orders, and inventory effortlessly.
- SuiteTalk Web Services Updates for NetSuite Integrations
SuiteTalk Web Services adds new Item Supply Plan support, enhancing integrations for efficient data management.
- SuiteTalk Web Services Enhancements in NetSuite
Explore the latest enhancements to SuiteTalk Web Services, improving integration and API functionalities in NetSuite.
Advertising
Reach Integration Professionals
Put your product in front of NetSuite experts who work with Integration every day.
Sponsor This Category