It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Add comment to an existing Jira issue using rest API

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

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

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

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
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,196 views 6 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you