Trying to get this to work. I keep getting a Missing ) after argument list. (line 6, file "Code")Dismiss. I've double checked my parenthesis, but no avail. Am I missing something?
I hope this is a reasonable question. Thank you.
function myFunction() {
var url = "https://company.harvestapp.com/people";
var headers = {
"Accept": "application/xml",
"Content-Type": "application/xml",
"Authorization": "Basic " + Utilities.base64Encode([email protected] +":"+pw)
};
var response = UrlFetchApp.fetch(url,headers);
var text = response.getResponseCode();
Logger.log(text);
}
Got it. Thanks to Brian, too. I finally realized that you need an "options" object where you pass the method and headers.
function myFunction() {
var url = "https://swellpath.harvestapp.com/people/";
var user = "[email protected]";
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);
}