Nour Khaled
01/30/2025, 9:39 AMCeligo AI
01/30/2025, 9:39 AMAI generated answer (using internal Slack threads):To obtain a request token in SuiteScript 2.0 for calling a Restlet, you would need to follow the OAuth 2.0 flow. Here are the steps: 1. Create an Integration Record: In your NetSuite account, navigate to Setup > Integration > Manage Integrations > New. Fill in the necessary details and make sure to check the 'Token-Based Authentication' checkbox. Once you save the record, you will receive a Client ID and Client Secret. Make sure to save these as they will not be shown again. 2. Generate a Token: Navigate to Setup > Users/Roles > Access Tokens > New. Select the application name (the integration record you created), user, and role. Once you save, you will receive a Token ID and Token Secret. Again, make sure to save these as they will not be shown again. 3. Call the Restlet: Now you can use the Client ID, Client Secret, Token ID, and Token Secret to authenticate your request to the Restlet. Here is a sample code snippet:
javascript
var headers = {
'Authorization': 'OAuth ' +
'oauth_signature="' + encodeURIComponent(tokenSecret) + '&' + encodeURIComponent(token) + '", ' +
'oauth_version="1.0", ' +
'oauth_nonce="' + encodeURIComponent(nonce) + '", ' +
'oauth_signature_method="HMAC-SHA1", ' +
'oauth_consumer_key="' + encodeURIComponent(consumerKey) + '", ' +
'oauth_token="' + encodeURIComponent(tokenId) + '", ' +
'oauth_timestamp="' + encodeURIComponent(timestamp) + '"'
};
var response = https.get({
url: '<https://rest.netsuite.com/app/site/hosting/restlet.nl?script=customscript_restletid&deploy=customdeploy_restletid>',
headers: headers
});
Please replace consumerKey
, tokenSecret
, tokenId
, token
, nonce
, timestamp
with your actual values. Also, replace customscript_restletid
and customdeploy_restletid
with your actual Restlet script and deployment IDs.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
01/30/2025, 9:40 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836043417
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834569335
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834168375
Celigo AI
01/30/2025, 9:40 AMArmanda
04/22/2025, 1:54 AM