NetSuite RESTlets API Provider Setup

To set up a new application in NetSuite, you must have administration integration privileges. Contact your system administrator if you do not have those privileges. 

Enabling RESTlets

For RESTlets to work on Netsuite, please enable the feature on your account by navigating to:
Setup > Company > Enable Features > SuiteCloud > Server SuiteScript.

To authenticate an element instance with NetSuite, you must know your Account ID, 

Get your NetSuite Account ID

To locate your account ID:

  1. Via a web browser, log in to your NetSuite production account http://netsuite.com/login
  2. In the menu, click Setup, Integration, then Webservice Preferences.
  3. Copy the ACCOUNT ID.

Custom Authentication

Cloud Elements supports NetSuite's token-based authentication with a custom authentication flow. For detailed provider information, see NetSuite's Token Based Authentication documentation.

Note: To use token-based (Custom) authentication, set up a new user linked to a single role. If you use an existing user, they might have multiple roles and the role used by the web service might not match the role selected as the web services role.

In order to authenticate using token-based/custom authentication, you must provide:

  • Consumer key
  • Consumer secret
  • Access token ID
  • Access token secret
  • Deployment ID and Script ID

You will also need to enable token-based authorization for your account, create an integration record for your application, create a relevant role, assign the role to a user, and generate your credentials/token. 

Follow these steps:

  1. Sign in to Netsuite, navigate to Setup > Company > Enable Features > Suite Cloud > Manage Authentication. Enable Token-Based Authentication and click Save. NetSuiteTokenAuthStep1.gif
  2. To create an integration record, navigate to Setup > Integration > Manage Integrations and select New.
  3. On the Integration page, do the following:
    1. Provide a name for your integration in the Name field
    2. Enable Token-Based Authentication and TBA: Issuetoken Endpoint
    3. Disable TBA: Authorization Flow and Authorization Code Grant
    4. Enable User Credentials
    5. Click Save
      After saving your integration, your consumer key and secret are displayed. Record these values, as this is the only time they will appear, and they cannot be retrieved again.
  4. Create a new custom role for the token-based authentication user by navigating to Setup > Users/Roles > Manage Roles > New.
  5. On the Role page, do the following:

    1. Provide a name for the role in the Name field.

    2. In the Setup tab of the Permissions section, add the User Access Tokens permission. Also add any additional relevant permissions based on your integration's needs and scope; for detailed information about available permissions, see Netsuite's documentation.

    3. Click Save.

  6. After successfully creating the role, navigate to Lists > Employees > Employees. Either select an existing employee listing, or create a new one.

  7. In the Roles section of the Employee page, assign the role you created above by selecting it from the Role menu and clicking Add. Click Save after assigning the role.

  8. After creating the employee and assigning the role, navigate to Setup > Users/Roles > Access Tokens > New.

  9. On the Access Token page, select the application, user, and role you created above. Add a name for your token, and then click Save.
    After saving the access token, your token ID and secret are displayed. Record these values; as with the consumer key and secret above, this is the only time the token ID and secret will be displayed.

Generating Script ID and Deployment ID

A NetSuite RESTlet is provided by Cloud Elements as a default script in the Cloud Elements NetSuite environment. Once deployed, a script Id and deployment Id is generated. Before provisioning an instance with Netsuite RESTlets, you need this script Id and the deployment Id. Here is how you can get them.

  1. Pick your SuiteScript file from https://github.com/cloud-elements/netsuiterestlets-releases/releases.
    On the home page, click the Customization tab and navigate to Scripting > Scripts > New, as shown in the image above.
  2. Upload your file and deploy it on the NetSuite environment. 
  3. Click Create Script Record after selecting the file you want to upload.
  4. After you upload the file, Save and Deploy it.
  5. A script Id and deployment Id is generated. 
  6. Use the script Id and deployment Id to provision your instance with NetSuite RESTlets.