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.) TheAuthorization
header should be in an explicitheaders
object. Plus, you don't need to set method toGET
since its the default.Something else to keep in mind for when you're making
POST
requests - Google Apps Script has this funny quirk where you have to define theContent-Type
header using thecontentType
property. If you try to set that header in theheaders
object if will just get overridden by the default (application/x-www-form-urlencoded
I believe).So here's how you'd set up your
GET
request:And for
POST
requests with a JSON payload you'd do something like this: