NetSuite REST Web Services/RESTlets with OAuth 2.0 using Postman

Introduction

SuiteCloud (SuiteTalk REST Web Services) is now usually available for all NetSuite products, extending a robust set of complementary SuiteTalk SOAP web services that have been part of NetSuite’s core integration solution for several releases. Including REST web services in SuiteTalk provides administrators and developers with even more options for integrating NetSuite with environments, external applications, and data sources. 

REST web services support API discoverability, offer link-based navigation, provide users with seamless access to NetSuite record metadata, and give users a uniform approach to interacting with both custom and standard records. 

No server-side coding or management of custom codes is necessary, as is the case with server-side RESTlets used to extend SuiteScript APIs when building REST-based integrations. 

This blog shows building REST-based integrations with OAuth 2.0 in your NetSuite Account, Postman Environment Setup, and POST Request. 

REST Web Services Prerequisites And Setup

To use the REST web services, the relevant features must be enabled in your NetSuite account: 

  • Go to Setup > Company > click Enable features.  
  • Select SuiteCloud subtab. 
  • Check the REST Web Services feature in the SuiteTalk (Web Services) section. 
  • Check the OAuth 2.0 checkbox in the Manage Authentication section. 
  • Check the SuiteAnalytics Workbook in (Analytics) subtab.  
  • Click Save. 

Assign The Required Permissions To The User Role

  • Go to Setup > Users/Roles > Manage Roles.  
  • Locate the role you want to modify. Click Edit or Customize link.  
  • On the Permissions subtab, click Setup.  
  • In the Permission list, select REST Web Services from the dropdown list. 
  • In the Level list, select Full. Click Add.  
  • In the Permission list under setup, select Log in using Access Tokens from the dropdown list. 
  • In the Level list, select Full. Click Add.  
  • Click Save. 

Unlock The Full Potential Of NetSuite With AlphaBOLD

Are you looking to harness the full power of NetSuite with seamless and secure integration? AlphaBOLD is here to guide you every step of the way. Our in-depth understanding of OAuth 2.0 ensures a robust, compliant, and user-friendly integration for your applications.

Request a Demo

Create Integration Records For Applications Using OAuth 2.0

The following steps describe how to create an integration record:.  

  • Go to Setup > Integration > Integration Management > Manage Integrations > Click New. 
  • Enter a name for your application in the required Name field. 
  • Enter a description in the Description field, if desired. 
  • Select Enabled in the State field. 
  • Enter a note in the Note field, if desired. 
  • On the Authentication tab, check the appropriate boxes for your application. 
  • Check the Rest Web Services & RESTlets box. 
  • Enter the valid redirect URI for your application, on which the authorization code will be handled. 
  • For the demo, I will be using https://google.com/
  • Under OAuth 2.0, check Authorization Code Grant for OAuth 2.0 to work. 
  • Click Save. 

Once you click on the Save button, the Client Credentials values are displayed on the page. 

Note: For security reasons, this only appears once; make sure you note them. 

NetSuite provides an account-specific domain containing the NetSuite account ID as part of the domain name to access REST web services or RESTlets. You can find the company URLs at Setup > Company > Company Information under the Company URLs subtab.

Setting Up Postman Environment

A Postman environment is a set of variables you can use in Postman requests. Using a Postman environment, you can switch between various NetSuite accounts and between your test or production accounts. Using Postman environments, you can customize requests using variables so you can switch between different setups without changing your requests. 

  1. Click the icon in the top menu of the Postman application.
  2. A popup window opens. Click Add on Manage Environments window.
  3. Enter a self-descriptive name for your environment 
  4. Enter your account ID (for example, 3604360)
  5. Enter the credentials you created, The value of the consumer key/ client id, and the consumer secret/ client secret.
  6. Add all the variables and values as above.
  7. Click Add. 

Creating Postman Collections

You can create a new collection by clicking the + New button in the left sidebar, the New button > hit the Collection option displayed on it. A new window will pop up. 

  • Give your new collection a Name. 
  • Select Type OAuth 2.0 under the Authorization section. 
  • The following detail will be automatically added;, if not, follow the below steps: 
  • Under Configure new token 
  • Enter Self- descriptive Token Name. 
  • Enter Auth URL 
  •  {{proto}}://{{account}}.app.{{nsdomain}}/app/login/oauth2/authorize.nl 
  • Enter Access Token URL 
  • {{proto}}://{{account}}.{{suitetalkapi}}.{{nsdomain}}/{{restservice}}/auth/oauth2/{{version}}/token 
  • Enter Scope (For REST Web Services enter rest_webservices & for RESTlets enter restlets).  
  • Click GET New Access Token. 
  • Login to your NetSuite account and click on the Continue button. 
  • On popup manage access tokens window. 
  • Click the Use Token button.  
  • Tokens will be automatically added under the current token. 
  • Click Create. 

RESTlet POST Request

  • After creating a new collection, click on Add requests to create your first request 
    {{proto}}://{{account}}. {{restletsapi}}.{{nsdomain}}/app/site/hosting/restlet.nl?script=<>&deploy=<> 
  • Add the RESTlet URL and enter the test body. 
  • Click Send. 
  • The success response will return 200 OK. 

We have the correct status, created a record, and also found a record Id in response. This means we could get into NetSuite and access our account information through third-party applications. Hence, we were authorized using OAuth 2.0
Read more about What Is REST API And What Makes An API Restful API

Discover Seamless NetSuite Integration with AlphaBOLD

Elevate your use of NetSuite with AlphaBOLD's expertise. Schedule a demo to explore advanced techniques and optimize your NetSuite environment. 

Request a Demo

Summary & Mandatory Steps To Follow Are

  • REST Web Services Prerequisites and Setup 
  • Assign the required permissions to a user’s role 
  • Create Integration Record, obtain Client Id and Client Secret 
  • Get REST URL from Company Information 
  • Postman Environment and Collection Setup 
  • Add request and test Integration 

Explore Recent Blog Posts