Netsuite Finance Authenticate an Element Instance

You can authenticate with NetSuite to create your own instance of the NetSuite 2018 Finance element through the UI or through APIs. Once authenticated, you can use the element instance to access the different functionality offered by the NetSuite platform.

Authenticate Through the UI

Use the UI to authenticate with NetSuite and create an element instance as described in Authenticate an Element Instance (UI). In addition to the base authentication parameters, you will need the credentials that you identified in API Provider Setup.

After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a virtual data resource, or use it in a formula template.

Authenticate Through API

Authenticating through API is similar to authenticating via the UI. Instead of clicking and typing through a series of buttons, text boxes, and menus, you will instead send API calls to our /instances endpoint. The end result is the same, though: an authenticated element instance with a token and id for future API calls.

If you are configuring events, see the Events section.

To create an element instance:

  1. Construct a JSON body based on your authentication type, either Basic or Custom. See Parameters for detailed descriptions.

    Basic Authentication
    {
       "element": {
         "key": "netsuitefinancev2"
       },
       "configuration": {
          "netsuite.sandbox": false,
          "netsuite.single.session": false,
          "filter.response.nulls": true,
          "event.notification.enabled": false,
          "event.vendor.type": "polling",
          "authentication.type": "basic",
          "user.username": "<USERNAME>",
          "user.password": "<PASSWORD>",
          "netsuite.accountId": "xxxxxxxxxxxxx",
          "netsuite.appId": "xxxxxxxxxxxxx"
       },
       "tags": [
         "<Add_Your_Tag>"
       ],
       "name": "<INSTANCE_NAME>"
     }
    Custom Authentication
     {
       "element": {
         "key": "netsuitefinancev2"
       },
       "configuration": {
          "netsuite.sandbox": false,
          "netsuite.single.session": false,
          "filter.response.nulls": true,
          "event.notification.enabled": false,
          "event.vendor.type": "polling",
          "authentication.type": "custom",
          "consumer_key": "xxxxxxxxx",
          "consumer_secret": "xxxxxxxxxx",
          "token_Id": "xxxxxxxxxxx",
          "token_secret": "xxxxxxxx",
          "netsuite.accountId": "xxxxxxxx"
       },
       "tags": [
         "<Add_Your_Tag>"
       ],
       "name": "<INSTANCE_NAME>"
     }
    
  2. Call the following, including the JSON body you constructed in the previous step:

    POST /instances
    
    Note: Make sure that you include your User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.
  3.    Locate the token and id in the response and save them for all future requests using the element instance.
  4. Example cURL

    Basic Authentication

    curl -X POST \
      https://api.cloud-elements.com/elements/api-v2/instances \
      -H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
      -H 'content-type: application/json' \
      -d '{
      "element": {
        "key": "netsuitefinancev2"
      },
      "configuration": {
        "netsuite.sandbox": false,
        "netsuite.single.session": true,
        "filter.response.nulls": true,
        "authentication.type": "Basic",
        "user.username": "my@somewhere.com",
        "user.password": "my_secret_password",
        "netsuite.appId": "my_app_id",
        "netsuite.accountId": "my_account_id"
      },
      "tags": [
        "Accounting"
      ],
      "name": "NetSuite Instance 1"
    }'
    

    Custom Authentication

    curl -X POST \
      https://api.cloud-elements.com/elements/api-v2/instances \
      -H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
      -H 'content-type: application/json' \
      -d '{
      "element": {
        "key": "netsuitefinancev2"
      },
      "configuration": {
        "netsuite.sandbox": false,
        "netsuite.single.session": true,
        "filter.response.nulls": "my_unique_key",
        "authentication.type": "custom",
        "consumer_key": "consumer_key_1234567",
        "consumer_secret": "secret_1234567",
        "token_id": "token_1234",
        "token_secret": "token_secret_1234",
        "netsuite.accountId": true,
        "event.notification.enabled": false
      },
      "tags": [
        "Accounting"
      ],
      "name": "NetSuite Instance 1"
    }'
    

    Parameters

    See Netsuite Finance API Provider Setup  for information on how to obtain authentication parameters.

    Note: Event related parameters are described in Events .    
    Parameter
    Description
    Data Type
    Required
    'key'
    The element key.
    netsuitefinancev2
    string

    Name
    name
    The name for the element instance created during authentication.
    Body

    Connect TO Sandbox
    netsuite.sandbox
    whether to use a NetSuite sandbox
    boolean
    Y
    Account ID
    netsuite.accountId
    the NetSuite account ID
    string
    Y
    Enforce Single Session
    netsuite.single.session
    whether to use single session to limit API requests to this account
    boolean
    N
    Specify Single Session Lock Key
    netsuite.single.session.key
    the unique key for this single session (only applicable if single session = true)
    Y if enforcing

    Authentication Type
    authentication.type
    The authentication type, which must be either basic or custom
    string
    Y
    Email
    user.username
    The email of a NetSuite authenticated user (only applicable for Basic authentication)
    string
    Y if Basic Authentication
    User Password
    user.password
    The password of a NetSuite authenticated user (only applicable for Basic authentication)
    string
    Y if Basic Authentication
    App ID netsuite.appId
    The App ID of a NetSuite integration (only applicable for Basic authentication).
    Complete these steps to find the App ID for your integration:
    1. Log into Netsuite.
    2. Navigate to Setup.
    3. Click Integrations.
    4. Click Manage Integrations, and then click New.
    5. On the New Integration page, name your application instance. Ensure that "Token Based Authentication" is unchecked and that "User Authentication" is checked.
    6. Click Save.

    Your Application ID is then generated.

    string
    Y if Basic Authentication
    Consumer Key
    consumer_key
    For Custom authentication, the consumer key of a token-based NetSuite integration.
    string
    Y if Token Based Authentication
    Consumer Secret
    consumer_secret
    For Custom authentication, the consumer secret of a token-based NetSuite integration.
    string
    Y if Token Based Authentication
    Access Token ID
    token_id
    For Custom authentication, the token ID of a token-based NetSuite integration.
    string
    Y if Token Based Authentication
    Access Token Secret
    token_secret
    For Custom authentication, the token secret of a token-based NetSuite integration.
    string
    Y if Token Based Authentication
    Filter null values from the response
    filter.response.nulls
    whether or not to filter out null values from the response
    boolean
    N

    Example Response        

    In this example, the authenticated element instance ID is 12345 and token starts with ABC/D.... Your values will be different. Make sure that you save the id and token for future requests.

    {
        "id": 12345,
        "name": "NetSuite Instance 1",
        "token": "ABC/D/efgHIJK1234lmnopQRS+1tuVWx+yz98765",
        "element": {
            "id": 988,
            "name": "NetSuite Instance 1",
            "key": "netsuitefinancev2",
            "description": "NetSuite 2018 Finance.",
            "active": true,
            "deleted": false,
            "typeOauth": true,
            "trialAccount": false,
            "configDescription": "NetSuite 2018 Finance",
            "signupURL": ""
        },
        "provisionInteractions": [],
        "valid": true,
        "eventsEnabled": true,
        "disabled": false,
        "maxCacheSize": 0,
        "cacheTimeToLive": 0,
        "cachingEnabled": false
    }