0
我尝试使用UrlFetchApp从API获取信息。我在POSTMAN中尝试了GET和POST命令,它工作正常。在谷歌Apps脚本的第一个作品,第二个返回错误404UrlFetchApp返回错误404
function pru_demo() {
// Log In.
var options = {
'method' : 'POST',
'contentType': 'application/json'
};
var response=UrlFetchApp.fetch('https://demo.erpnext.com/api/method/[email protected]&pwd=demo', options);
var data=JSON.parse(response)
Logger.log(data.full_name);
// Get Employes
options = {
// 'muteHttpExceptions' : true,
'method' : 'GET',
'contentType': 'application/json'
};
response=UrlFetchApp.fetch('https://demo.erpnext.com/api/resource/Employee', options);
Logger.log(response.getContentText());
}
曾任职完美。非常感谢。 –