June 10, 2025

NetSuite REST API Integration With Mulesoft Using OAuth2

NetSuite REST API Integration With Mulesoft Using OAuth2

The SuiteTalk platform enables seamless integration between NetSuite and various on-premise applications or third-party cloud environments using CSV, SOAP, and REST web services. This versatility supports building website-to-NetSuite integrations or custom mobile applications tailored to specific business needs.

Overview of SuiteTalk and NetSuite’s REST API

SuiteTalk’s REST web services provide a user-friendly, REST-based interface to interact with NetSuite, extending its capabilities. The API, still in beta, offers access to company-specific record metadata and simplifies handling custom records and fields without requiring custom scripts, unlike RESTlets. Tvarana’s integration team has successfully leveraged this API to connect NetSuite with the MuleSoft platform using NetSuite OAuth2 for secure data retrieval.

Step-by-Step Guide: NetSuite OAuth2 Integration with MuleSoft Anypoint Studio

Below is a streamlined guide to configuring NetSuite OAuth2 authentication in MuleSoft Anypoint Studio, ensuring a robust integration.  

1.Add a listener to the flow and give the respective listener configuration and path.

2. Drag and drop a HTTP Request operation from Mule palette.

NetSuite OAuth2 Mulesoft Anypoint Studio Integration

3. Request Configuration for Netsuite Oauth Authentication:

  • Add a Request configuration, change the name of the configuration as required, and select the protocol from the given drop-down list (HTTPS)
  • Enter the host as <netsuite-account-id>.suitetalk.api.netsuite.com
  • The base path would be /services/rest/record/v1
  • In the Authentication Type as “Authorization Code grant type” (if this authentication type is not available in the drop down then you haven’t added the Oauth module).
NetSuite OAuth2 Mulesoft Anypoint Studio integration
  • The Local Callback configuration, shown in the figure above, uses a different Listener configuration for the callback. The Listener configuration would look like
NetSuite OAuth2 Mulesoft Anypoint Studio Integration
  • Click Ok to return to the Request Configuration. Add /callback as the Local Callback configuration path. The external callback URL is the redirect URL entered in the users's NetSuite account. State value can be any random string like (ykv2XLx1BpT5Q0F3MRPHb94l)
  • Local Authorization URL is the main URL through which incoming requests are sent and outgoing requests are received. It is important to note that the Local Authorization URL and Local Callback URL must have the same port and cannot be left empty. The Local Authorization URL would be https://localhost:8082/web
  • The Authorization URL for Netsuite is https://<netsuite-account-id>.app.netsuite.com/app/login/oauth2/authorize.nl
  • Enter the values of client ID and client secret, generated when creating the NetSuite Integration Record.The scope would be rest_webservices
  • The token for NetSuite is https://<netsuite-account-id>.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token
  • Check to ensure that all details entered are correct and save the configuration
NetSuite OAuth2 Mulesoft Anypoint Studio Integration
NetSuite OAuth2 Mulesoft Anypoint Studio Integration
  • In the Mulesoft console, the error message looks like the screenshot below
NetSuite OAuth2 Mulesoft Anypoint Integration
  • This error has occurred because an access token was not generated. In order to generate the access token, the Local Authorization URL needs to be triggered. Once this is done, the user will be redirected to Netsuite Login page
NetSuite OAuth2 Mulesoft Anypoint Integration
  • After logging into their NetSuite account, the user is redirected to the permission page, seen in the screenshot below
NetSuite OAuth2 Mulesoft Anypoint Integration
  • Click on continue to be redirected to a page with the message- Successfully retrieved access token
NetSuite OAuth2 Mulesoft Anypoint Integration
  • This completes the generation of access token. Now trigger the listener to view the result, in this case, the list of customers (the result is in the form of URLs)
NetSuite OAuth2 Mulesoft Anypoint Integration

To explore how Tvarana can enhance your NetSuite integration, Schedule a call with us today!

Related Blogs

No items found.
View All