N/https/clientCertificate Module for Secure SSL Requests

The N/https/clientCertificate module enables sending SSL requests using digital certificates in NetSuite, enhancing secure communication.

·2 min read·View Oracle Docs

The N/https/clientCertificate module allows developers to send SSL-secured requests using a digital certificate. This module is vital for ensuring that communications with remote servers are secure, which is increasingly important in today's data-driven environment. By employing this module, administrators and developers can integrate secure API calls within their NetSuite scripts.

How Do the Methods Work?

The clientCertificate module offers several methods to interact with remote servers securely via different HTTP request types:

clientCertificate.post(options)

Sends an SSL secured POST request to a remote server. This method is primarily used for sending data that modifies resources on the server.

clientCertificate.get(options)

Invokes an SSL secured GET request to retrieve data from a remote server. Use this when you need to read data without side effects.

clientCertificate.put(options)

This method sends an SSL secured PUT request for updating resources on the server, ideal when existing resources need modification.

clientCertificate.delete(options)

Utilized to send a DELETE request, this method allows for securely removing resources from the server.

clientCertificate.request(options)

This method handles general requests, providing flexibility in dealing with various scenarios when a specific type of request is not predefined.

Parameter Configuration

Each method accepts an options parameter that includes:

Parameter NameTypeRequiredDescription
options.urlstringYesThe URL address of the remote server.
options.certIdstringYesThe ID of the client certificate.
options.bodystringYesThe data to be sent in the request.
options.headersobjectNoAdditional HTTPS headers for the request.

Example: Sending a Secure POST Request

Here is an example illustrating how to use the clientCertificate.post() method to send a secure POST request to a remote server:

suitescript
1/**
2 * @NApiVersion 2.1
3 */
4
5require(['N/https/clientCertificate'], (cert) => {
6 // Set the URL
7 const url = "https://example.com/api";
8 let data = "Here is the payload data";
9 const key = "custcertificate1";
10 let headers = {
11 "Content-Type": "application/json"
12 };
13
14 let response = cert.post({
15 url: url,
16 certId: key,
17 body: data,
18 headers: headers
19 });
20});

This script demonstrates how to make a secure request while ensuring that sensitive data remains protected through SSL.

Who This Affects

  • Developers: Those who are implementing or maintaining secure API integrations.
  • Administrators: Administrators implementing security policies and practices.

Key Takeaways

  • The N/https/clientCertificate module is essential for secure communications in NetSuite.
  • It supports multiple HTTP methods: POST, GET, PUT, DELETE, and general requests.
  • Developers must manage SSL certificates to ensure secure interactions with external servers.

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

Frequently Asked Questions (4)

Do I need to enable any feature flags to use the N/https/clientCertificate module?
The article does not specify the need for enabling any feature flags to use the N/https/clientCertificate module.
What parameters are required to use methods like post and get in the clientCertificate module?
Each method requires options including 'options.url' (the URL of the remote server), 'options.certId' (the ID of the client certificate), and 'options.body' (the data to be sent in the request). 'options.headers' is optional.
How does the clientCertificate module handle different HTTP methods?
The module supports various methods like post, get, put, delete, and a general request method, allowing developers to perform different types of HTTP actions securely using digital certificates.
Can the clientCertificate module handle additional HTTPS headers in requests?
Yes, the 'options.headers' parameter can be used to include additional HTTPS headers in requests, though it is not required.
Source: N/https/clientCertificate Module Members 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 →