Skip to main content

Configuring Netsuite as Source

Configuring Netsuite as the Source: A Comprehensive Guide 

This guide provides a comprehensive walkthrough for setting up Netsuite as the source. By following these steps, you will be able to configure Netsuite as the source smoothly and efficiently. 

Data Source :

Step 1:

·       In the Data Source page, Select the source type as API

Step 2:

  • Now select the “Oracle NetSuite” as your product

Step 3:

·       Choose the appropriate business object based on your needs.

Note: In the event the desired product or business object isn't available, you have the option to select 'Create New' in the product name field. Provide the necessary details for the new product and the business object you intend to configure as the source.

Note: Opting for 'Create New' requires the user to furnish all necessary details essential for configuring the API as the source.


Step 4:

·       After selecting the business object for example, upon selecting 'Customer Retrieve API (Version: v1) (Method: GET)' as the designated business object, all pertinent information linked to the Oracle NetSuite API specifically tailored for the 'Customer' category will populate within the respective fields (Headers and Pre-request script are populated in this case)


placeholder.png


From the image above, it's evident that the HTTP method is configured as GET, and the API endpoint URL field is populated with a value :

{{base_url}}/services/rest/record/{{version}}/customer/{{customer_id}}?fields=entityId,companyName,entityStatus,salesRep

Provide the following details in the API Endpoint URL:

  • base_url: Replace {{base_url}} with your NetSuite instance base URL. For example, if your NetSuite instance is https://123456.suitetalk.api.netsuite.com, use this as your base URL.

  • version: Replace {{version}} with the API version you are using. For example, if you are using version 2021.1, use 2021.1.

  • customer_id: Replace {{customer_id}} with the ID of the customer record you want to retrieve. For example, if the customer ID is 12345, use 12345.


Params:

limit:
This parameter specifies the maximum number of records to return in the response. {%max_num%} its string interpolated by default, it takes the values from Numeric Params

offset:
This parameter specifies the starting point for the records to return. {%min_num%} its string interpolated by default, it takes the values from Numeric Params


Headers:

  • Authorization: please observe that the value "{%signature%}" undergoes string interpolation. Avoid making any modifications to this value.
  • Prefer: This header is set to transient. It indicates that the response from the server can be transient, meaning it might not be stored or cached.
  • Content-Type: This header is set to application/json. It indicates that the request body format is JSON.




image.png




Step 5
: Pagination (Offset Pagination)


This pagination we will apply when we have "hasMore":true in our API response.

image.png

Select offset pagination from the dropdown and fill these values there.

Oracle NetSuite typically utilizes offset pagination.

image.png

 
  • In the above example hasMore key helps to identify upto which page the pagination will be completed , so it will come in User Key
  • As we are using Offset pagination so Key Name to Update will be offset
  • Data Collection Key holds the data from the API and we will get the response in that key for example here it is ['items'].
 

Step 6: Pre-Request Script

In Pre-request Script tab, ensure to input all necessary details like

  • url: The full API endpoint URL.
  • oauth_consumer_id: Your OAuth consumer ID.
  • oauth_consumer_key: Your OAuth consumer key.
  • oauth_consumer_secret: Your OAuth consumer secret.
  • oauth_token: Your OAuth token.
  • oauth_token_secret: Your OAuth token secret.
  • request_method: The HTTP request method (e.g., GET, POST).


import datetime
import random
import string
import hashlib
import base64
import hmac
import urllib
oauth_consumer_id = '{{consumer_id}}'               # Provide Values
oauth_consumer_key = '{{consumer_key}}'             # Provide Values
oauth_consumer_secret ='{{consumer_secret}}'        # Provide Values
oauth_token ='{{token}}'                            # Provide Values
oauth_token_secret ='{{token_secret}}'              # Provide Values
###########################################################################################################################################################
request_method = '{{method}}'
url = '{{Endpoint URL}}'
oauth_signature_method = 'HMAC-SHA256'
oauth_timestamp = str(int(datetime.datetime.now().timestamp()))
oauth_nonce = ''.join(random.choices(string.ascii_letters + string.digits, k = 11))
oauth_version = '1.0'
normalized_request_method = request_method.replace(' ', '')
normalized_string_url = urllib.parse.quote(url, safe = '')
normalized_params = {'oauth_consumer_key': oauth_consumer_key,'oauth_token': oauth_token,'oauth_signature_method': oauth_signature_method,'oauth_timestamp': oauth_timestamp,'oauth_nonce': oauth_nonce,'oauth_version': oauth_version,'limit':max_num,'offset':min_num}
sorted_params = dict(sorted(normalized_params.items()))
normalized_string_parmas = [k+'='+v for k,v in sorted_params.items()]
normalized_string_parmas = '&'.join([str(elem) for elem in normalized_string_parmas])
normalized_string_parmas.replace(' ','')
normalized_string_parmas = urllib.parse.quote(normalized_string_parmas, safe = '')
base_string = request_method + '&' + normalized_string_url + '&' + normalized_string_parmas
base_string = str.encode(base_string)
signature_key = oauth_consumer_secret + '&' + oauth_token_secret
signature_key = str.encode(signature_key)
oauth_signature = hmac.new(signature_key, base_string, hashlib.sha256)
oauth_signature.hexdigest()
oauth_signature = base64.b64encode(oauth_signature.digest())
oauth_signature = oauth_signature.decode('UTF-8')
oauth_signature = urllib.parse.quote(oauth_signature, safe = '')
signature ='OAuth realm="'f'{oauth_consumer_id}",oauth_consumer_key="'f'{oauth_consumer_key}",oauth_token="'f'{oauth_token}",oauth_signature_method="'f'{oauth_signature_method}",oauth_timestamp="'f'{oauth_timestamp}",oauth_nonce="'f'{oauth_nonce}",oauth_version="'f'{oauth_version}",oauth_signature="'f'{oauth_signature}"'

After completing all the required details, the user can establish the connection to Oracle NetSuite.