The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add comment to an existing Jira issue using rest API

Nigel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Alex Medved _ConfiForms_
Community Champion
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
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
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_
Community Champion
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');
}
TAGS
AUG Leaders

Atlassian Community Events