Forum Stats

  • 3,851,507 Users
  • 2,263,992 Discussions
  • 7,904,751 Comments

Discussions

How to implement a connection to Netsuite using Apps Script?

User_R5CK4
User_R5CK4 Member Posts: 1 Green Ribbon

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);

}