HTTP DELETE Method in SuiteScript for Asynchronous Requests
The HTTP DELETE method in SuiteScript enables asynchronous request handling, essential for modern API interactions.
The HTTP DELETE method in SuiteScript allows developers to send asynchronous HTTP DELETE requests, effectively managing resource deletions from a server. This feature is critical for applications that need to handle resource management dynamically.
Method Description
This method sends an HTTP DELETE request and returns a Promise object, which represents the eventual success or failure of the asynchronous operation. It's important to note that this method is available for both client and server scripts.
Important Points:
- If the connection to the server takes longer than 5 seconds, it will time out.
- The method does not function in unauthenticated client-side contexts.
Syntax
The following code example demonstrates how to use the http.delete.promise method:
1var headerObj = {2 name: 'Accept-Language',3 value: 'en-us'4};5 6http.delete.promise({7 url: 'http://www.mytestwebsite.com',8 headers: headerObj9})10 .then(function(response){11 log.debug({12 title: 'Response',13 details: response14 });15 })16 .catch(function onRejected(reason) {17 log.debug({18 title: 'Invalid Request: ',19 details: reason20 });21 });Governance
Using this method consumes 10 governance units, so it is essential to manage your script’s governance effectively to avoid hitting limits.
Related Topics
Who This Affects
- Developers: Those implementing server or client-side scripts.
- Administrators: Individuals overseeing SuiteScript governance and usage.
Key Takeaways
- The HTTP DELETE method allows asynchronous deletion of resources.
- Returns a Promise object for handling response callbacks efficiently.
- It costs 10 governance units per call.
- Works in both client and server scripts but not in unauthenticated contexts.
Frequently Asked Questions (4)
Does the HTTP DELETE method in SuiteScript work in both client and server scripts?
Are there any time constraints when using the HTTP DELETE method in SuiteScript?
Can the HTTP DELETE method be used in an unauthenticated client-side context?
What is the governance cost associated with using the HTTP DELETE method in SuiteScript?
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.
