Selecting an HTTP/HTTPS Method for Calling a RESTlet
When you call a RESTlet, you can use one of four HTTP/HTTPS methods: delete, get, post, or put. Use the N/https module to connect SuiteScript scripts, RESTlets, and SuiteTalk REST endpoints without needing to reauthenticate. Use https.requestRestlet(options) or https.requestSuiteTalkRest(options) to send HTTPS requests to a RESTlet or REST endpoint.
When you call a RESTlet, keep these things in mind:
-
A call's method must match an entry point defined in the RESTlet
-
Each http/https method is dependent on the entry points within the RESTlet
-
Input data is handled differently by each http method
A Call’s Method Must Match an Entry Point
Each HTTP/HTTPS method (delete, get, post, put) matches a RESTlet entry point. Your call must use the method that’s defined in the RESTlet’s interface, or it won’t work.
Here’s an example: A Suitelet uses the https.get method to call a RESTlet. Since the RESTlet’s interface includes a get entry point, the call works.

HTTP/HTTPS Methods are Dependent on RESTlet Script Entry Points
A RESTlet doesn’t always have to follow the normal rules for HTTP/HTTPS methods. For example, you could write a get entry point that accepts data to post (though that’s not best practice).
The following http methods are supported for RESTlets: delete, get, post, and put. These methods are defined at the following link: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
.
Keep in mind, a RESTlet’s behavior depends on how you write the script and might not match the intended behavior of the HTTP method. For example, you could have a get entry point that creates data or a post entry point that doesn’t require input—but you should not do that
Input Data Is Handled Differently by Different HTTP Methods
RESTlet entry points handle input parameters differently, depending on which one you use.
How you pass input to a RESTlet depends on the HTTP method:
-
For delete and get, put arguments in the URL when you call the RESTlet.
-
For post and put, add arguments to the request body, using JSON or plain text.
HTTPS Methods for Secure Communication Between SuiteScripts and REST Endpoints
SuiteScript scripts, RESTlets, and SuiteTalk REST endpoints now share authentication from an existing session. Before, you had to log in again if you called one script from another. Now, the N/https methods let you skip reauthentication:
-
https.requestRestlet(options) – This method sends an https request to a RESTlet and returns the response. Authentication headers are automatically added. The RESTlet endpoint identified by its script ID is passed as a parameter. The RESTlet will run with the same privileges as the calling script.
-
https.requestSuiteTalkRest(options) – This method sends an https request to a SuiteTalk REST endpoint and returns the response. Authentication headers are automatically added. The REST endpoint identified by its URL is passed as a parameter.
This new method means you don’t have to make a Suitelet available without login or set it to execute as Administrator just to pass information between SuiteScripts, RESTlets, or REST APIs.
These methods are just for calling RESTlets within NetSuite, not from outside applications.