The N/https module in NetSuite is designed to facilitate secure HTTPS calls to third-party services, ensuring that all communications are encrypted. This module provides similar functionalities to the N/http module but restricts communications to the HTTPS protocol only. It can be utilized in both client and server scripts.
Key Features and Usage
The N/https module supports various content types when making POST requests, ensuring compatibility with a wide range of data formats. When using https.post(options) and specifying a content type in the header, NetSuite respects the following content types:
- All text media types (types starting with “text/”)
- “application/json”
- “application/vnd.maxmind.com-country+json”
- “application/xml”
- “application/soap+xml”
- “application/xhtml+xml”
- “application/atom+xml”
If a content type other than these is specified, NetSuite defaults to either:
- “text/xml; charset=UTF-8”
- “application/x-www-form-urlencoded; charset=UTF-8”
When the body parameter is provided as an object, it is URL-encoded, and the content type is automatically set to “application/x-www-form-urlencoded; charset=UTF-8.”