Skip to main content

Configuring Source as Netsuite

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

Please include all the important information about the instance you want to connect to Oracle NetSuite in the API endpoint URL.

Note : In the Headers tab, please observe that the value "{%signature%}" undergoes string interpolation. Avoid making any modifications to this value.


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 including url, oauth_consumer_id, oauth_consumer_key, oauth_consumer_secret, oauth_token, oauth_token_secret, request_method

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.