Skip to Main Content

Programming Languages & Frameworks

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to implement a connection to Netsuite using Apps Script?

User_R5CK4Aug 29 2022

Hi, I'm trying to make a connection using Apps Script, but I'm having trouble with the signature: I can't create it because I think I'm not using the correct algorithm, but it could be something else. So I want to know if there's a sample code (in Apps Script or JavaScript) or something I can use because there's not much information on the web. Here's the code I've been working on:
function getRequest(){
let url = "";
let marcaDeTiempo = timeEstampd(); //function to create timestamp
//Logger.log(marcaDeTiempo);
let text = ""; //text parameter
let consumerSecret = "";
let tokenSecret = "";
let key = Utilities.base64Encode(consumerSecret) + "&" + Utilities.base64Encode(tokenSecret); //key parameter
/**utf-8 */
let key2 = Utilities.base64DecodeWebSafe(consumerSecret);
let signature = crypto(text, key);

Logger.log("SIGNATURE "+Utilities.base64Encode(signature) + " " + marcaDeTiempo);
Logger.log(text2);
Logger.log(key);
Logger.log(key2);

var formData = {
'Authorization': '',
'Cookie': '',
'Content-type': ''
};

var options = {
method : 'get',
headers : formData,
"muteHttpExceptions": true
};

let response = UrlFetchApp.fetch(url, options);

Logger.log(response);
}

Comments

Post Details

Added on Aug 29 2022
0 comments
254 views