I am trying to send an authentication token in a request to Jira from Google Apps Scripts. I haven't been able to make it work. I've tried using tokens by base64 encoding my email and password as well as ones from the API token section of my profile. Neither works. I have success using a colleague's token, but he doesn't know how he got it. Any help would be appreciated!
function testEdit(){
let headers = {
"content-type": "application/json",
"Accept": "application/json",
"Authorization": "Basic Y2hhc2XXXXX” //Chase
};
// A final few options to complete the JSON string
let data =
{
"fields" : {
//"customfield_10110" :
"summary":
{"value" : "foo"}
}
};
var payload = JSON.stringify(data);
var options = {
"content-type": "application/json",
"method": “PUT”,
"headers": headers,
"payload": payload,
"muteHttpExceptions":false
};
var response = UrlFetchApp.fetch("http://whisper.atlassian.net/rest/api/2/issue/IMG-1625", options);
let responseContent = response.getContentText();
let jsonContent = JSON.parse(responseContent);
Logger.log(jsonContent.key);
}