Ble*_*exy 2 api harvest google-apps-script
试图让它发挥作用。我在参数列表后不断收到 Missing ) 。(第 6 行,文件“Code”)驳回。我仔细检查了我的括号,但无济于事。我错过了什么吗?
我希望这是一个合理的问题。谢谢。
function myFunction() {
var url = "https://company.harvestapp.com/people";
var headers = {
"Accept": "application/xml",
"Content-Type": "application/xml",
"Authorization": "Basic " + Utilities.base64Encode(dude@dude.com +":"+pw)
};
var response = UrlFetchApp.fetch(url,headers);
var text = response.getResponseCode();
Logger.log(text);
}
Run Code Online (Sandbox Code Playgroud)
知道了。也感谢布莱恩。我终于意识到您需要一个“选项”对象来传递方法和标头。
function myFunction() {
var url = "https://swellpath.harvestapp.com/people/";
var user = "dude@dude.com";
var password = "supersecurepw";
var headers = {
"Accept": "application/xml",
"Content-Type": "application/xml",
"Authorization": "Basic "+ Utilities.base64Encode(user+":"+password)
};
var options = {
"method" : "get",
"headers" : headers
};
var response = UrlFetchApp.fetch(url,options);
Logger.log(response);
}
Run Code Online (Sandbox Code Playgroud)