SuiteScript 2.x RESTlet Reference

A RESTlet is a SuiteScript you can call from an external app or another SuiteScript. Depending on how you write it, it might also return data to the caller.

A RESTlet can do anything you can build with SuiteScript. In general, you can use a RESTlet to:

When you build a RESTlet, you’ll need to learn how to deploy and call it—these steps are a bit different than other script types. You’ll also want to know about authentication, governance, and security for RESTlets.

Deploying a RESTlet. To use a RESTlet, follow the normal process for entry point scripts—create a script record and deployment record for your RESTlet script file. For details, see Deploying a RESTlet.

Calling a RESTlet. When you save a deployment record, NetSuite gives you a URL you can use to call your RESTlet. Since RESTlets run only when called, this URL is key. See Identifying a RESTlet in a Call for more.

Once your RESTlet is live, you can call it with delete, get, post, or put. Depending on the method, you might put input in the URL or in the request body. Just make sure your script has an entry point that matches the method you use. For more, see Selecting an HTTP/HTTPS Method for Calling a RESTlet.

For most RESTlet calls, add a Content-Type header so NetSuite knows how to read your input and format the response. See Creating a Content–Type Header for more.

RESTlet Authentication. A key benefit of RESTlets is that NetSuite always requires authentication. If the RESTlet call comes from outside NetSuite, you’ll need to add an authentication header. Learn more RESTlet Authentication.

Governance and Security. With RESTlets, keep governance and security rules in mind—they’re a bit different for this script type. For more, see RESTlet Governance and Security.

Debugging a RESTlet. You can debug RESTlet code just like any other SuiteScript—use the NetSuite Debugger or the debug client in SuiteCloud IDE. The client’s available once you start a debug session. See Debugging a RESTlet for more.

Related Topics

General Notices