NetSuite Data Retrieval

(1 review)

home

Illustrates how to use Mule Runtime to build a simple HTTP application using APIkit to fetch data from NetSuite. After reading this document, creating and running the example in Mule, you should be able to leverage what you have learned to create an HTTP request-response application that is able to retrieve requested data from NetSuite instance based on your criteria.

This example can also be used while configuring any of our Anypoint NetSuite Templates for retrieving Customers, Items, and Opportunities data.

60758010-NetSuiteDataRetrievalExample.png

Prerequisites

This document describes the details of the example within the context of Anypoint Studio. This document assumes that you are familiar with Mule Runtime and the Anypoint Studio interface.

Example Use Case

This application employs APIkit Router component to route HTTP requests to exact flow defined by resource and method. Afterwards, the flows prepare search criteria request for NetSuite connector using the HTTP query parameters. The response is transformed to the JSON and returned to the user.

Set Up and Run the Example

As with other examples, you can create template applications straight out of the box in Anypoint Studio. You can tweak the configurations of these use case-based examples to create your own customized applications in Mule.

Follow the procedure below to create, then run the NetSuite Data Retrieval application.

  1. Open the Example project in Anypoint Studio from Anypoint Exchange.
  2. Go to Global Elements and open NetSuite Connector element. Fill in your NetSuite credentials.
  3. Run the application. The APIkit console should start and the user can choose which endpoint wants to hit. The main:

    • GET /customers
      • Returns customers data from a NetSuite instance according to the specified parameters.
      • Users can define one HTTP query parameter: - name
        • name - Defines the String that the customer's name starts with.
    • GET /items
      • Returns items data from the NetSuite instance according to the specified parameters.
      • Users can define two HTTP query parameters: - quantity, operator
        • quantity - Defines the Number that the items count have to match in agreement with the operator value.
        • operator - Defines the operator that define the operation about the quantity number; there are five types to choose: LESS_THAN, GREATER_THAN, EQUAL_TO, LESS_THAN_OR_EQUAL_TO, GREATER_THAN_OR_EQUAL_TO
    • GET /opportunities
      • Returns sales orders data from the NetSuite instance according to the specified parameters.
      • User should define one HTTP query parameter: - title
        • title - Defines the String that the opportunities's title starts wit.h
  4. Click the resource you want to use, specify the parameters, and click GET.

  5. You see the retrieved data structure. If the data in the NetSuite instance does not match your criteria, an empty list is returned. In case you want to list all the data about all objects, leave the parameters fields blank.

How it Works

The NetSuite Data Retrieval example application contains NetSuite integration flows and exception handling. The main flow receive user HTTP requests and using the APIkit router process them to the right flow or handle exception.

The sections below elaborate further on the configurations of the application and how the flow works to respond to end user requests.

get:/customers:netsuite-api-config

This flow is responsible for displaying data about customers from Netsuite system.

At the beginning, using the DataWeave transformer the Search criteria request - CustomerSearch object - using the query parameters is prepared.

Next, the NetSuite connector retrieves the data using the created search criteria.

Finally, the response from Netsuite system is transformed by DataWeave transformer into JSON structure and sent back to the end user.

get:/items:netsuite-api-config

This flow is responsible for displaying data about items from Netsuite system.

At the beginning, using the DataWeave transformer the Search criteria request - ItemSupplyPlanSearchBasic object - using the query parameters is prepared.

Next, the NetSuite connector is used to retrieve the data using the created search criteria.

Finally, the response from Netsuite system is transformed by DataWeave transformer into JSON structure and sent back to the end user.

get:/opportunities:netsuite-api-config

This flow is responsible for displaying data about opportunities from Netsuite system.

At the beginning, using the DataWeave transformer the Search criteria request - OpportunitySearch object - using the query parameters is prepared.

Next, the NetSuite connector is used to retrieve the data using the created search criteria.

Finally, the response from NetSuite system is transformed by DataWeave transformer into JSON structure and sent back to the end user.


Reviews

TypeExample
OrganizationMuleSoft
Published by
MuleSoft Organization
Published onSep 6, 2018
Asset overview

Asset versions for 2.1.x

Asset versions
VersionActions
2.1.4
2.1.3
2.1.2

Categories

Functions
SalesNo values left to add
Products
OracleNo values left to add
Difficulty
AverageNo values left to add