HTTP DELETE Request Syntax in SuiteScript 2.0
Learn the syntax for making HTTP DELETE requests in SuiteScript 2.0, including required parameters and error handling.
The HTTP DELETE request in SuiteScript 2.0 sends a request to delete a specified resource from a server. Understanding how to construct this request is essential for developers looking to implement server communications effectively.
Method Description
Sending an HTTP DELETE request can allow you to manage server resources by removing unwanted entries. Here are some key points regarding the DELETE method:
- Timeouts: If it takes longer than 5 seconds to connect to the server, the request will time out. If sending the request payload exceeds 45 seconds, it will also time out.
- Client-Side Context: This method cannot be executed in unauthenticated client-side contexts, which means proper authentication is crucial.
Returns
The DELETE request can return either a http.ClientResponse or http.ServerResponse, depending on the context in which the request is made.
Supported Script Types
- Client scripts
- Server scripts
For more information, consult the SuiteScript 2.x Script Types documentation.
Governance
Each call for the DELETE request counts as 10 governance units.
Parameters
The method utilizes an options parameter, which is a JavaScript object, structured as follows:
| Parameter | Type | Required / Optional | Description |
|---|---|---|---|
options.url | string | required | The HTTP URL being requested. |
options.headers | Object | optional | The HTTP headers you want to include. |
Note: In DELETE requests, a request body is not necessary.
Error Handling
When executing the DELETE request, various errors might occur. Here are some common error codes you should be aware of:
| Error Code | Message | Thrown If |
|---|---|---|
SSS_INVALID_HOST_CERT | An untrusted or invalid certificate was found for this host. | Security negotiation failed or domain name is invalid. |
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.url parameter is missing. |
Syntax Example
The following code snippet demonstrates the correct usage of the HTTP DELETE method:
1var headerObj = {2 name: 'Accept-Language',3 value: 'en-us'4};5var response = http.delete({6 url: 'http://www.mytestwebsite.com',7 headers: headerObj8});For more extensive scripting examples, refer to the N/http Module Script Samples.
Key Takeaways
- The HTTP DELETE request is utilized to remove resources from a server.
- Proper construction of the
optionsparameter is essential, particularly for theurl. - Careful error handling is crucial to ensure reliable server communications.
Frequently Asked Questions (4)
What permissions are required to execute HTTP DELETE requests in SuiteScript 2.0?
Are there any timeout constraints for HTTP DELETE requests in SuiteScript 2.0?
What types of scripts support using the HTTP DELETE method in SuiteScript 2.0?
How does an invalid URL affect HTTP DELETE requests in SuiteScript 2.0?
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