Identifying a RESTlet in a Call
Before you call a RESTlet, you’ll need to know how to identify it, which depends on whether you’re calling it from inside or outside NetSuite. Usually, you'll use values from the script deployment record, and sometimes the script record ID too.
Internal Versus External Calls
The script and deployment records have everything you need to identify a RESTlet. The exact values to use depend on where the call comes from.

Source of the Call |
Identify the RESTlet with: |
---|---|
An external client |
A full URL, similar to the one shown on the script deployment record, in the External URL field (callout 4). For details, see Dynamically Generating a Full URL. |
A client SuiteScript with an active session in the same NetSuite account where the RESTlet is deployed |
Either of the following:
|
A server SuiteScript in the same NetSuite account where the RESTlet is deployed |
A full URL, similar to the one shown on the script deployment record, in the External URL field callout (4). This URL must be dynamically generated, in one of the following ways:
|
A server SuiteScript in a different NetSuite account from where the RESTlet is deployed |
A full URL, similar to the one shown on the script deployment record, in the External URL field (callout 4). This URL must be dynamically generated by using the REST roles service. For details, see Dynamically Generating a Full URL. |
If you are calling a RESTlet by using the delete or get method, you must extend the URL to include any input data that is required by the RESTlet’s logic. For details, see Selecting an HTTP/HTTPS Method for Calling a RESTlet.
Dynamically Generating a Full URL
When you save the deployment record, NetSuite gives you the full URL in the External URL field. But don’t hard-code this URL—add logic to build the RESTlet domain dynamically instead.
You can do this in a couple of ways:
-
To call a RESTlet from an external source, use NetSuite’s roles service. For details on using this service, see The REST Roles Service.
-
To call a RESTlet from within NetSuite, you can use the N/url module. With this approach, you provide the ID values from the script record and script deployment record. For an example, see Example of a Suitelet that Calls a RESTlet.
Since 2017.2, you can use account-specific domains for RESTlets at .restlets.api.netsuite.com. The old data center-specific domains still work, too. For more info, see URLs for Account-Specific Domains.