-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