Module netsuite

ballerinax/netsuite Ballerina library

3.3.0

Overview

NetSuite's SuiteTalk SOAP API provides the capability to access NetSuite operations related to different kinds of NetSuite records such as Account, Client, Transactions, Invoice, Classifications etc.

This module supports NetSuite WSDL 2020.2.0 version.

Prerequisites

Before using this connector in your Ballerina application, complete the following:

  • Create a NetSuite account
  • Obtain tokens tokens
    1. Go to NetSuite and sign in to your account.

    2. If you have NetSuite permission to create an integration application, the following steps may be helpful. If not, proceed to step 3.

      1. Enable the SuiteTalk Web service features of the account (Setup->Company->Enable Features).

      2. Create an integration application (Setup->Integration->New), enable TBA code grant and scope, and obtain the following credentials:

      • Client ID
      • Client secret
    3. If you have client ID, client secret from your administrator, obtain the credentials below by following the token based authorization in the NetSuite documentation.

      • Access token
      • Access token Secret
    4. Obtain the SuitTalk Base URL that contains the account ID under the company URLs (Setup->Company->Company Information).

      e.g., https://<ACCOUNT_ID>.suitetalk.api.netsuite.com

Quickstart

To use the NetSuite connector in your Ballerina application, update the .bal file as follows:

Step 1 - Import connector

  • Create a Ballerina file and import the following Netsuite module.
Copy
import ballerinax/netsuite;

Step 2 - Create a new connector instance

  • Create a NetSuite client by providing credentials. Initialize the connector by giving authentication details in the HTTP client configuration, which has built-in support for Token Based Authentication(TBA). The NetSuite connector can be initialized by the HTTP client configuration using the client ID, client secret, access token, and the access token secret. You can use the Ballerina Configuration variable to store your credentials.
Copy
public function main() returns error? {
    netsuite:NetsuiteConfiguration nsConfig = {
        accountId: "<accountId>",
        consumerId: "<consumerId>",
        consumerSecret: "<consumerSecret>",
        token: "<token>",
        tokenSecret: "<tokenSecret>",
        baseURL: "<webServiceURL>"
    };

    netsuite:Client netsuiteClient = check new(nsConfig);

Step 3 - Invoke connector operation

  1. Invoke the connector operation using the client.
Copy
netsuite:RecordInputRef currency = {
    internalId: "1",
    'type: "currency"
};
netsuite:NewAccount account = {
    acctNumber: "1234567",
    acctName: "Ballerina NetSuite Demo Account",
    currency: currency
};
netsuite:RecordAddResponse newAccount = check netsuiteClient->addNewAccount(account);
  1. Use bal run command to compile and run the Ballerina program.

You can find a list of samples here

Import

import ballerinax/netsuite;Copy

Metadata

Released date: about 1 year ago

Version: 3.3.0

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.8.0

GraalVM compatible: Yes


Pull count

Total: 4796

Current verison: 40


Weekly downloads


Source repository


Keywords

Business Management/ERP

Cost/Paid


Contributors

Other versions

See more...