I want to edit a field of an existing issue using rest api within request. I can acces GET method easily and get the data using rest api, but cannot access PUT/POST method(got 403()). So have added the following code,
AP.request({
type: 'POST',
contentType: 'application/json',
dataType: 'json',
data: {"fields": {"description": "testing"}},
url: 'https://mysite.atlassian.net/rest/api/2/issue/XYZ-5',
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', 'basic: '+ base_auth(user, password));
},
success: function (response) {
alert("success");
},
error: function (data, status, error) {
alert("failed");
console.log('error', data, status, error);
}
});
function base_auth(user, password)
{
var loginDetail = user + ':' + password;
var tag = btoa(loginDetail);
return "Basic " + tag;
}
But, while using this i get the same error 403() not permitted and also beforeSend code does not get hit.
Already, have posted question regarding Edit and Update issue here.
If using CURL code can fix this issue, can you please suggest how to use the CURL code within request with a sample code.