如何对外调用netsuite restlet?

How to call netsuite restlet externally?

我已尝试使用 google 脚本,但出现错误:

'USER_ERROR error message:No Authorization header'

var url = 'https://debugger.na1.netsuite.com/app/site/hosting/restlet.nl?script=107&deploy=1';

var header = {
    contentType: 'application/json',
    Authorization: 'NLAuth nlauth_account=TSTDRVXXXXX,    nlauth_email=xxx@xxx.com, nlauth_signature=XXXXXXX, nlauth_role=3',
    method: 'GET',
    muteHttpExceptions: true
  };

  var response = UrlFetchApp.fetch(url, header);

您应该查看 UrlFetchApp 的文档。您折叠了 headers 和可选参数。设置应该更像是:

var params = {
    contentType: 'application/json',
    headers:{Authorization: 'NLAuth nlauth_account=TSTDRVXXXXX, nlauth_email=xxx@xxx.com, nlauth_signature=XXXXXXX,     nlauth_role=3'},
    method: 'GET',
    muteHttpExceptions: true
};
var response = UrlFetchApp.fetch(url, params);