Connecting Data Targets
Connecting Oracle Netsuite as a Target :
Step 1 : Choose the Target Type as 'API'.
Step 2 : Enter 'Oracle NetSuite' in the target name field and select 'Oracle NetSuite' from the dropdown options.
Step 3 : According to the requirements, pick the Oracle NetSuite business object from the available dropdown menu.
Note : In case the desired business object isn't listed in the dropdown, users have the option to create both a new product and a new business object by selecting the 'Create New' option within the target name dropdown menu.
Step 4 : After selecting the business object, all relevant details pertaining to the Oracle NetSuite API corresponding to the chosen business object will populate across the required fields within the API section.
For example, upon selecting 'Customer' 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)
From the image above, it's evident that the HTTP method is configured as POST, and the API endpoint URL field is populated with a value :
https://{{account_id}}.suitetalk.api.netsuite.com/services/rest/record/v1/customer
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.
In Pre-request Script tab, ensure to input all necessary details including oauth_consumer_id, oauth_consumer_key, oauth_consumer_secret, oauth_token, oauth_token_secret.
import datetime
import random
import string
import hashlib
import base64
import hmac
import urllib.parse
request_method = 'POST'
url = 'https://{{account_id}}.suitetalk.api.netsuite.com/services/rest/record/v1/customer'
oauth_consumer_id = 'xxxxxxxxxxxxxxx' # Provide Values
oauth_consumer_key = 'xxxxxxxxxxxxxx' # Provide Values
oauth_consumer_secret ='xxxxxxxxxxxx' # Provide Values
oauth_token ='xxxxxxxxxxxx' # Provide Values
oauth_token_secret ='xxxxxxxxxxxxx' # Provide Values
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}
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.