Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How do I get the latest comment via REST API call

Hi Everyone,

 

I've been working on a project where I want to fetch the latest comment(if any) from Jira issue and update it in our tool. Now, when I am using the below endpoint, I am getting all comments which are unnecessary for me. 

 

https://jira.dev.corp.adobe.com/rest/api/2/search?jql=issue=AMSAUTO-10517&fields=comment

Response - 

"key": "AMSAUTO-10517",
"fields": {
"comment": {
"comments": [
{
"self": "https://jira.dev.corp.adobe.com/rest/api/2/issue/5187946/comment/16530402",
"id": "16530402",

 

One observation - I could see that I can get the comment by using "fields=comment" in the jql search, so, is there any way to grab the comments under comment?

 

Please look into it and help me with this.

 

Regards,

Snehangshu Sarkar

1 answer

0 votes

Hello,

You need to go through all comments in the comments array ("comments": [.....])  and find the latest one.

Hi Alexey,

 

Thanks for the update.

Is there any way to get the latest comment only via REST API or grab the comments under comment in endpoint? Because If I am able to grab the comments, then I can use StartAt=maxResults to get only the latest one.

 

Regards,

Snehangshu Sarkar

There is no special rest api for getting the latest comment. You need to iterate over all comments and find the latest one.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS

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