N/http and N/https Support PATCH Method in NetSuite
N/http and N/https now support the PATCH method for API calls, enhancing integration in NetSuite. TL;DR Opening TL;DR Opening
TL;DR Opening
N/http and N/https modules in NetSuite now support the PATCH method, enabling developers to perform updates directly via API calls. This enhancement is crucial for improving integration capabilities within applications, making it easier to modify existing resources.
What Changed?
Starting in the latest update, the method enumeration in both N/http and N/https modules includes the PATCH method. This addition allows users to make more granular updates to resources via external calls and Suitelet calls using the following functions:
http.request(options)https.request(options)https.requestSuitelet(options)clientCertificate.request(options)
How to Use PATCH Method?
You can pass either http.Method.PATCH or https.Method.PATCH in any parameter that requires a method value. However, if a particular API endpoint does not permit the PATCH method, users will receive an HTTP 405 error indicating that the method is not allowed.
Important Considerations
-
Ensure that the
optionsparameter (a JavaScript object) correctly contains the required fields to use the PATCH method:options.method: required, must be set using eitherhttp.Method.PATCHorhttps.Method.PATCH.options.url: required, this should be the URL to which the request is made.options.body: optional, applicable only for PATCH requests alongside PUT and POST.options.headers: optional, for specifying additional HTTP/S headers.
-
Timeouts: If a connection to the destination server takes longer than 5 seconds, a timeout will occur. Similarly, if the request payload takes longer than 45 seconds, the request will timeout. This means that good error handling is essential to manage these scenarios appropriately.
Example Usage
Here is a simple example of using the PATCH method with the N/http module:
1var http = require('N/http');2 3var options = {4 method: http.Method.PATCH,5 url: 'https://api.example.com/resource/123',6 body: JSON.stringify({ key: 'value' }),7 headers: {8 'Content-Type': 'application/json'9 }10};11 12var response = http.request(options);This example demonstrates how to send a PATCH request to update a specific resource identified by its ID. Always check the responses to ensure validation and handle any errors that may occur.
Who This Affects
- Developers: Anyone developing or maintaining integrations with external services using the N/http or N/https modules will benefit from this feature.
- Administrators: Those responsible for system integrations may need to review changes in API usage.
Key Takeaways
- The PATCH method is now available in N/http and N/https modules.
- It allows for partial updates to resources via API calls.
- Ensure correct error handling for HTTP 405 responses when using PATCH.
- Understand the timeout limits on request connections and payloads for efficient API interaction.
Frequently Asked Questions (4)
Do I need to enable a feature flag for using the PATCH method in N/http and N/https?
What happens if I try to use the PATCH method on an endpoint that does not support it?
What permissions are required to use the PATCH method with these modules?
Will implementing the PATCH method affect existing API workflows in my NetSuite environment?
Was this article helpful?
More in Integration
- Loop Returns Integration in NetSuite Connector 2026.1
Updated to include features of the Loop Returns integration in NetSuite Connector 2026.1. Loop Returns Integration in NetSuite Connector 2026.1
- Create Integration Records for OAuth 2.0 in NetSuite 2026.1
In NetSuite 2026.1, administrators can create integration records for applications to use OAuth 2.0, enabling secure access. Here's how.
- 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.
Advertising
Reach Integration Professionals
Put your product in front of NetSuite experts who work with Integration every day.
Sponsor This Category