Deploying a RESTlet
Before you use a RESTlet, follow the usual script guidelines—make sure the script’s set up right and create a script record.
To format your RESTlet correctly, make sure:
-
The script must have the correct SuiteScript 2.x structure. For example, your script needs at least one entry point and function that matches the RESTlet script type. For more information about how to structure a SuiteScript 2.x script, see Required Structure for Entry Point Scripts. The entry points you use decide how the RESTlet can be called. To learn more, see SuiteScript 2.x RESTlet Script Entry Points and API.
-
Your script needs the right JSDoc tags—at minimum, add
@NScriptType RESTlet
(any capitalization works). For details, see Required JSDoc Tags for Entry Point Scripts.
Before you call a RESTlet, upload the script file to your File Cabinet and create both a script record and script deployment record. For help, see SuiteScript 2.x Record-Level Script Deployments.
When creating these records for a RESTlet, be aware of the following:
-
Enter clear info in your script record and deployment record ID fields. The system uses your text to create IDs, which can help you recognize the RESTlet in other scripts.
-
Unlike other script types, RESTlets aren’t tied to any specific record type—they’re available on their own.
-
The deployment record’s Status field has “Released” and “Testing” options. The Status must be “Released” before you can call the RESTlet from outside NetSuite.
-
Saving the deployment record creates a partial and full URL for calling your RESTlet—you’ll see these on the page.
If you use the full URL in an integration, be sure to add logic that finds the RESTlet domain dynamically. See Identifying a RESTlet in a Call for more info.