Context - I have been working on a small locally hosted browser app using JavaScript to parse reporting we receive on a daily basis and upload specific data fields to our tickets via the API.
Currently using the following methods I have been successful with updating individual fields and adding comments etc. However when attempting to transition a status I receive a 403 response.
function updateField(user, token) {
$.ajax({
type: "PUT",
url: "https://{Web Address}/rest/api/2/issue/" + ticketRef,
dataType: "json",
headers: { "Authorization": "Basic " + btoa(user+":"+token),
"Content-Type": "application/json",
'X-Atlassian-Token': 'nocheck' },
data: JSON.stringify({ "fields": {
"description":"Description Update",
"customfield_10543":"Update Test"
}
}),
success: function (json) { console.log(json) },
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status); console.log(thrownError); console.log(ajaxOptions);
}
});
}
function addComment(user, pass) {
$.ajax({
type: "PUT",
url: "https://{Web Address}/rest/api/2/issue/" + ticketRef,
dataType: "json",
headers: { "Authorization": "Basic " + btoa(user+":"+token),
"Content-Type": "application/json",
'X-Atlassian-Token': 'nocheck' },
data: JSON.stringify({
"update": { "comment": [{"add": {"body": "Comment Test"}}] }
}),
success: function (json) { console.log(json) },
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status); console.log(thrownError); console.log(ajaxOptions);
}
});
}
This next function is where I am experiencing issues. I am wondering if this could possibly be some form of permissions issue with the Jira server settings, especially as all other information can be modified except for transitions.
I have tried several variations of headers etc.
I am using an API token + user id for auth with base64 encoding.
I do not have direct access to the Server and therefore would need to present information backing my assertions to have any settings updated if it was a permissions issue.
function updateStatus(user, token) {
$.ajax({
type: "POST",
url: "https://{Web Address}/rest/api/3/issue/" + ticketRef + "/transitions",
dataType: "json",
headers: { "Authorization": "Basic " + btoa(user+":"+token), "accept": "application/json",
"cache-control": "no-cache", "Content-Type": "application/json",
'X-Atlassian-Token': 'nocheck'},
data: JSON.stringify({'transition' : {'id': '131' }}),
success: function (json) {
console.log(json)
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status);
console.log(thrownError);
console.log(ajaxOptions);
}
});
}
Any insight or assistance would be greatly appreciated.