A NetSuite RESTlet assists you in developing custom RESTful web services with the help of SuiteScript. Highly scalable and easily maintainable, RESTful web services are REST Architecture-based web services that are mostly used to create powerful APIs for multiple web-based applications.
Being an open-source framework built on the Java platform, RESTlet web services are used for both server web applications as well as client web applications. These are extremely useful and support data format and Internet transport. Besides, they also support many service description standards such as HTTP, HTTPS, XML, SMTP, JSON, WADL, and Atom.
Further, RESTlest provides well-built event handlers for several most commonly utilized HTTP request methods: GET, POST, PUT, and DELETE. Whenever a request has been sent to a RESTlet, it will be routed to the appropriate event handler function on the basis of the HTTP request method that has been used.
The HTTP headers, OAuth tokens, as well as user sessions are used to authenticate any RESTlet.
How to set up a typical NetSuite RESTlet?
Usually, a NetSuite RESTlet is established with the help of three simple steps:
1. Add Scripts to NetSuite
2. Create Script to NetSuite –
Only those files will appear which are already inside the suite scripts folder in File Cabinet.
3. Select RESTlet from the Script types-
4. Put the name of your RESTlet and id of the RESTlet.
5. Now deploy the script
6. Creating deployment for the RESTlet.
7. Now you’ll get Restlet internal and external URL. Use this external URL in any REST Client.
8. Now you have set up integrations to get Customer Key and Customer secret key –
9. Now Choose Token-Based Authentication from here–
10. Copy these Ids for future use. If you step away from this page, they can’t be retrieved
11. Create New Access Token
12. Choose your Application Name form here. We are using Demo Integration which we created in the Integrations section.
13. Token generated, Now you can go to any REST client and put Consumer Keys and Token there to authorize.
Next step – Input your RESTlet URL and method type in the client.
Choose a Signature method to HMAC-SHA256