Forums

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

How to get all worklogs and comments for issues in a sprint using Jira Search API?

Abhishek Gupta
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!
April 8, 2025

Hi community,
I'm currently working with the Jira REST API and I'm using the Search API with a JQL query to fetch all issues for a particular sprint.
My goal is:
  • To retrieve all worklogs and comments for each issue in that sprint,
  • And if possible, sort worklogs and comments by newest first.
My current query looks like this:
GET /rest/api/2/search?jql=sprint = "MOBL-01APRIL"&fields=summary,worklog,comment&expand=worklog,renderedFields
Questions:
  1. Is it possible to retrieve all worklogs and comments for each issue directly using the Search API?
    • If not, is there an efficient way to get the complete data (maybe via a secondary request per issue)?
  2. What is the default limit for worklogs and comments returned per issue via the Search API?
  3. Is there a way to sort the worklogs and comments by newest first within the API response?
Any guidance, workarounds, or best practices would be appreciated!
Thanks in advance!

1 answer

0 votes
Abdallah Khaled
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 15, 2025

Hi @Abhishek Gupta 

  • Each API endpoint may have a different limit for the number of items returned. As a consequence, the maxResults in the request is overridden if it is above the limit defined for a given REST API endpoint for example for "Issue comments" the max is 100 entries you can see each API endpoint default max results parameter from our official API guide here . You can use pagination to retrieve more entries by specifying the startAt and maxResults parameters in your subsequent requests and append them altogether, you can see more details here,
  • Within the API issue search results, worklogs and comments are not sorted by default. To sort them by newest first, you need to handle this client-side after fetching the complete data. unfortunately, the cloud rest api has no sort endpoint, I can see a similar feature request raised to address this: https://jira.atlassian.com/browse/JRACLOUD-91954 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events