Add comment to an existing Jira issue using rest API

Nigel February 10, 2020

Hi all,

I currently have web form set up in Confluence which collects information from the end user and creates a Jira issue.

Current code:

url: [confluence-domain]/rest/jira-integration/1.0/issues?applicationId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
type: 'POST',
dataType: 'JSON',
contentType: "application/json",
data: JSON.stringify(issueData),

Is there a way to use the same API to add comments to / update an existing issue?

Thanks,

Nigel

 

1 answer

0 votes
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 10, 2020

Hi Nigel

You can certainly add comments and update existing issue with the REST API, check the docs

https://docs.atlassian.com/software/jira/docs/api/REST/8.7.0/#api/2/issue-addComment

https://docs.atlassian.com/software/jira/docs/api/REST/8.7.0/#api/2/issue-editIssue

 

However, I am unsure what the API you are using (jira-integration/1.0/issues) is... looks like a some kind of custom made wrapper around Jira APIs, no?

 

Alex

Nigel February 12, 2020

Hi Alex,

Thanks for the information :)

I'm still running into issues using the below code, any thoughts on what the issue might be.

function UpdateIssue() {
AJS.$.ajax({
url: 'https://jiraURL/rest/api/2/issue/ABC-123',
data: '{"update" : {"summary" : [{"set" : "Test"}], ' +
'"comment": [{"add": {"body": "Test Comment"}}]}}',
type: 'PUT',
contentType: 'application/json',
dataType: 'json',
error: function () {
alert('Error');
},
success: function() {
document.location.reload();
}
})
}

Thanks,

Nigel

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2020

What does Jira say? What is in the error response the Jira returns you? It will tell you what exactly it dislikes about your JSON

Obviously this, does not help in troubleshooting

error: function () {
alert('Error');
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events