Employee System API - Netsuite Implementation Template

(0 reviews)

home

This Anypoint Template provides a foundation for designing an Employee System API. It provides means of hiding the complexity of the Netsuite APIs from a user while exposing data in a canonical format. The template abstracts employee data from Netsuite into canonical objects that are defined within a CRM System API. This API uses JSON as an exchange format and translates calls into the semantic data structure required by Netsuite.

License Agreement

Note that using this template is subject to the conditions of this License Agreement.

Please review the terms of the license before downloading and using this template. In short, you are allowed to use the template for free with Mule ESB Enterprise Edition, CloudHub, or as a trial in Anypoint Studio.

Use Case

This Anypoint template serves as a foundation for API Led Connectivity approach of running an enterprise.

The template is a System API to underlying NetSuite system.

This template is a REST API implemented using APIkit and RAML definition. The basic CRUD operations are implemented for Employee object. The API uses JSON as an exchange format. Included are example requests and responses.

Below are the endpoints that are implemented.

GET /employees
Retrieves employees from NetSuite based on the combination of query parameters. At least one of modifiedAfter or name should be set to retrieve results. Look at the included RAML definition to learn more about the implemented query parameters.

POST /employees
Inserts new Employee to NetSuite

GET /employees/{id}
Retrieves an Employee based on the given NetSuite native identifier.

PATCH /employees/{id}
Updates an Employee with the data in the HTTP request. All fields are overwritten.

DELETE /employees/{id}
Deletes specific Employee based on the given NetSuite native identifier.

Look at the included self-descriptive RAML definition and the corresponding flows to learn more about the flows.

Considerations

To make this template run, there are certain preconditions that must be considered. All of them deal with the preparations, that must be made for the template to run smoothly.

Failing to do so could lead to unexpected behavior of the template.

NetSuite Considerations

Customer must be assigned to subsidiary. In this template, this is done statically and you must configure the property file with subsidiary internalId that is already in the system. You can find out this number by entering 'subsidiaries'

into the NetSuite search field and selecting 'Page - Subsidiaries'. When you click on the 'View' next to the subsidiary chosen, you will see the ID in the URL line. Please, use this Id to populate nets.customer.subsidiary.internalId property in the property file.

Run it!

Simple steps to get API Led Connectivity System API for NetSuite running.

Running on premise

In this section we detail the way you should run your template on your computer.

Where to Download Mule Studio and Mule ESB

First thing to know if you are a newcomer to Mule is where to get the tools.

  • You can download Mule Studio from this Location
  • You can download Mule ESB from this Location

Importing a template into Studio

Mule Studio offers several ways to import a project into the workspace, for instance:

  • Anypoint Studio Project from File System
  • Packaged mule application (.jar)

You can find a detailed description on how to do so in this Documentation Page.

Running on Studio

Once you have imported you template into Anypoint Studio you need to follow these steps to run it:

  • Locate the properties file mule.dev.properties, in src/main/resources
  • Complete all the properties required as per the examples in the section Properties to be configured
  • Once that is done, right click on you template project folder
  • Hover you mouse over "Run as"
  • Click on "Mule Application"

Running on Mule ESB stand alone

Complete all properties in one of the property files, for example in [mule.prod.properties] (../master/src/main/resources/mule.prod.properties) and run your app with the corresponding environment variable to use it. To follow the example, this will be mule.env=prod.

Running on CloudHub

While creating your application on CloudHub (Or you can do it later as a next step), you need to go to Deployment > Advanced to set all environment variables detailed in Properties to be configured as well as the mule.env.

Deploying your template on CloudHub

Mule Studio provides you with really easy way to deploy your Template directly to CloudHub, for the specific steps to do so please check this link

Properties to be configured (With examples)

In order to use this Mule template you need to configure properties (Credentials, configurations, etc.) either in properties file or in CloudHub as Environment Variables. Detail list with examples:

Application configuration

Common Configuration

  • http.port 9090

NetSuite Connector Configuration

  • nets.email user@company.com
  • nets.password secret
  • nets.account TSTDRV2123985
  • nets.roleId 3
  • nets.appId 8BDDC777-E81C-466D-AB9E-1EF2504927B2
  • nets.customer.subsidiary.internalId 1

Customize It!

This brief guide intends to give a high level idea of how this template is built and how you can change it according to your needs.

As mule applications are based on XML files, this page will be organized by describing all the XML that conform the template.

Of course more files will be found such as Test Classes and Mule Application Files, but to keep it simple we will focus on the XMLs.

Here is a list of the main XML files you'll find in this application:

system-api.xml

A functional aspect of this template implemented in this XML is to create or update objects in the destination system for a represented use case. You can customize and extend the logic of this template in this XML to more specifically meet your needs.

Configuration for Connectors and Configuring Properties are also set in this file. Even though you can change the configuration here, all parameters that can be modified here are in properties file, and this is the recommended place to do it so. Of course if you want to do core changes to the logic you will probably need to modify this file.

In the visual editor they can be found on the Global Element tab.


Reviews

TypeTemplate
OrganizationMuleSoft
Published by
MuleSoft Organization
Published onSep 23, 2019
Asset overview

Asset versions for 2.1.x

Asset versions
VersionActions
2.1.1