function getClickupTeam() {
let response = UrlFetchApp.fetch(clickupUrl + "team", {
"method": "GET",
"Authorization": clickupToken,
"muteHttpExceptions": true
})
Logger.log(response)
let json = JSON.parse(response);
Logger.log(json);
}
This URLFetchApp call returns {ECODE=OAUTH_017, err=Authorization header required} even though I am including my personal clickup token in the request. Am I missing something? Any help would be appreciated.
It looks like your request is malformed (be sure to check out the reference documentation for the
UrlFetchApp.fetch(url, params)method.) TheAuthorizationheader should be in an explicitheadersobject. Plus, you don't need to set method toGETsince its the default.Something else to keep in mind for when you're making
POSTrequests - Google Apps Script has this funny quirk where you have to define theContent-Typeheader using thecontentTypeproperty. If you try to set that header in theheadersobject if will just get overridden by the default (application/x-www-form-urlencodedI believe).So here's how you'd set up your
GETrequest:And for
POSTrequests with a JSON payload you'd do something like this: