2016-07-15 100 views
-1

我从谷歌的脚本,但得到错误的尝试:如何从外部调用netsuite restlet?

'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, [email protected], nlauth_signature=XXXXXXX, nlauth_role=3', 
    method: 'GET', 
    muteHttpExceptions: true 
    }; 

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

回答

1

,应先查看文档的UrlFetchApp。您已折叠标题和可选参数。设置应该更像是:

var params = { 
    contentType: 'application/json', 
    headers:{Authorization: 'NLAuth nlauth_account=TSTDRVXXXXX, [email protected], nlauth_signature=XXXXXXX,  nlauth_role=3'}, 
    method: 'GET', 
    muteHttpExceptions: true 
}; 
var response = UrlFetchApp.fetch(url, params); 
+0

非常感谢...现在可以工作 – YNK

+0

太棒了。您是否愿意将我的答案标记为已接受。 – bknights