NetSuite REST API Integration With Mulesoft Using OAuth2
June 10, 2025
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.
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).
The Local Callback configuration, shown in the figure above, uses a different Listener configuration for the callback. The Listener configuration would look like
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
Once the flow has been deployed, apply the listener configured in the steps above. User will see the error message- No Access Token Found
In the Mulesoft console, the error message looks like the screenshot below
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
After logging into their NetSuite account, the user is redirected to the permission page, seen in the screenshot below
Click on continue to be redirected to a page with the message- Successfully retrieved access token
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)