HTTP DELETE Method in SuiteScript for Asynchronous Requests

The HTTP DELETE method in SuiteScript enables asynchronous request handling, essential for modern API interactions.

·2 min read·1 views·View Oracle Docs

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:

suitescript
1var headerObj = {
2 name: 'Accept-Language',
3 value: 'en-us'
4};
5
6http.delete.promise({
7 url: 'http://www.mytestwebsite.com',
8 headers: headerObj
9})
10 .then(function(response){
11 log.debug({
12 title: 'Response',
13 details: response
14 });
15 })
16 .catch(function onRejected(reason) {
17 log.debug({
18 title: 'Invalid Request: ',
19 details: reason
20 });
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.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

Does the HTTP DELETE method in SuiteScript work in both client and server scripts?
Yes, the HTTP DELETE method in SuiteScript is available for both client and server scripts.
Are there any time constraints when using the HTTP DELETE method in SuiteScript?
Yes, if the connection to the server takes longer than 5 seconds, it will time out.
Can the HTTP DELETE method be used in an unauthenticated client-side context?
No, the HTTP DELETE method does not function in unauthenticated client-side contexts.
What is the governance cost associated with using the HTTP DELETE method in SuiteScript?
Using the HTTP DELETE method consumes 10 governance units per call.
Source: Syntax Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Integration

View all Integration articles →