Skip to Main Content

Programming Languages & Frameworks

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
107 views