Update existing issue field data in JIRA using rest api Edited

I have created a rest api to access an issue in JIRA. If I edit value of a field and save it using a button click, how to update the new value in that corresponding issue replacing the old value?

I have viewed the following links regarding editing and updating issues, but do not have idea how to access them.

1) Editing issue
2) Updating issue

Have added a sample code using PUT in request as follows,

AP.require(['request'], function(request) {
request({
url: 'https://mysite.atlassian.net/rest/api/2/issue/XYZ-5',
type: 'PUT',
data: {
"fields": {"assignee":{"name":"harry"}}
},
success: function(response) {
alert("success");
document.location.reload();
},
error: function (response) {
alert('fail... ');
}
});
});

But I get an error 403 - as no permission to access.

Can anyone help me with a basic example for updating values in an issue?

1 answer

0 votes

It looks to me like your code is not logging you in.  Without a login, you don't have permission to updates the issue.

I am using the same procedure to get the issue details using request and also able to access fields using the below code,

AP.require(['request'], function(request) {
request({
url: 'https://mysite.atlassian.net/rest/api/2/issue/XYZ-5',
type: 'GET',
success: function(response) {
alert("success");
},
error: function (response) {
alert('fail... ');
}
});
});

Again, your code does not appear to log in, so it has no permission to do things.

Using the above code GET method worked for me, only POST didn't work. So, can you please help me working with Edit Issues using POST method with a basic example.

Suggest an answer

Log in or Join to answer

Stay in touch

Be the first to know what's trending on Atlassian Community

Community showcase
Gregory Van Den Ham
Published Monday in Jira

Got TLSv1.2?

...connector settings, you'll see something like: <Connector SSLEnabled="true" if you don't see a line that says "ciphers=".....", you may have a problem. How to fix it? So you got a B on your...

101 views 2 1
Read article
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot