I'm able to create new issues via API, but I'm receiving 404 returns on the following:
var jiraComment = message.getSubject();
var issueKey = matchedValue;
var url = "https://COMPANY.atlassian.net/rest/api/latest/issue/"+issueKey+"/comment";
var data = {
"body": {
"content": [
{
"content": [
{
"text": jiraComment,
"type": "text"
}
],
"type": "paragraph"
}
],
"type": "doc",
"version": 1
},
// "visibility": {
// "identifier": "Administrators",
// "type": "role",
// "value": "Administrators"
// }
};
var payload = JSON.stringify(data);
var headers =
{
"content-type": "application/json",
"Accept": "application/json",
"authorization": "Basic APIKEY"};
var options =
{
"content-type": "application/json",
"method": "POST",
"headers": headers,
"payload": payload
};
var response = UrlFetchApp.fetch(url, options);
Logger.log(response.getContentText());
var dataAll = JSON.parse(response.getContentText());
var commentId = dataAll.id
Logger.log(commentId);
When I take the manually created url in my browser I'm able to return appropriate results.
I use the same APIKEY to create the jira, so I figured it should work here as well.