This article is a simple tutorial of how to test NetSuite RESTlet scripts that use Token-based Authentication with the help of a third-party app, Postman.

As a prerequisite, make sure that the Token-based Authentication feature found at: Setup > Company > Enable Features > SuiteCloud is enabled in order to for you to proceed with the other steps.

I. Acquiring the Consumer Key and Consumer Secret

  1. Go to Setup > Integrations > Manage Integrations > New.
    ns-restlet-enable-feature
    Image 1: Setup > Integrations > Manage Integrations > New
    ns-consumer-key-consumer-secret
    Image 2: Consumer Key/Consumer Secret
    ns-restlet-deployment-url
    Image 3: External URL
  2. Enable Token-based Authentication.
  3. You will receive the following message, along with the Consumer Key and Consumer Secret. Save it somewhere secure.
Warning: For security reasons, this is the only time that the Consumer Key and Consumer Secret values are displayed. After you leave this page, they cannot be retrieved from the system. If you lose or forget these credentials, you will need to reset them to obtain new values.

Treat the values for Consumer Key and Consumer Secret as you would a password. Never share these credentials with unauthorized individuals and never send them by email.

II. Acquiring the Token ID and Token Secret

  1. If your role is granted with User Access Token permission, you should be able to see Manage Access Tokens inside the Settings portlet.
    ns-porlet-manage-access-token
    Image 4: Manage Access Tokens
  2. Click on New My Access Token.
  3. Select an Application Name and enter your preferred Token Name.
    ns-application-name-token
    Image 5: Naming
  4. Click ā€œSaveā€.
  5. You will see this message, along with Token ID and Token Secret. Save the Token ID and Token Secret to somewhere secure.
Warning: For security reasons, this is the only time that the Token ID and Token Secret values are displayed. After you leave this page, they cannot be retrieved from the system. If you lose or forget these credentials, you will need to reset them to obtain new values.

Treat the values for Token ID and Token Secret as you would a password. Never share these credentials with unauthorized individuals and never send them by email.

III. Creating your first RESTlet collection in Postman

  1. Go to https://www.getpostman.com/ to download the Postman application.
  2. After installing, create a New Collection.
  3. After creating a new collection, create your first request by clicking on Add requests .
postman-add-request
Image 6: Add requests

IV. Testing your first RESTlet in Postman

Follow the steps as depicted in the screenshot below.

postman-send-restlet-request
Image 7: Testing with Postman
  1. Select the appropriate request method (e.g. GET, POST, etc.).
  2. Enter the URL as grabbed from the deployment record. For more information on deploying your first RESTlet, go to this article.
  3. Click on Authorization.
  4. Select OAuth 1.0.
  5. Enter the following parameters:
    • Consumer Key (from Section I, Step 3)
    • Consumer Secret (from Section I, Step 3)
    • Access Token (from Section II, Step 6)
    • Token Secret (from Section II, Step 6)
  6. Enter the NetSuite Account ID under Advanced > Realm
  7. Hit Save so you won’t lose the request you configured.
  8. Click on Send to test!

LEACC Consulting is a team of NetSuite Certified Developers with IT experience solely dedicated to NetSuite technologies for eight years. We are experts in both SuiteScript 2.0 and SuiteScript 1.0. Our team has worked with 400+ NetSuite scripts and workflows combined. If you need some consulting help of how you can design your NetSuite scripts better, contact us by filling out this form or by commenting below.

Do you have NetSuite Development needs? Do you need help with a solution like this? Click on the link below and let’s have a chat about your project requirements!

Contact us for your NetSuite needs!

2 comments

  1. Important to note that the latest version of Postman will not by default set the ā€œAdd authorization data toā€ dropdown to request headers by default on a GET request.

Leave a Reply