# Get all the worklogs for the issues of a jql

**URL:** <https://community.developer.atlassian.com/t/get-all-the-worklogs-for-the-issues-of-a-jql/48202>\
**Category:** Jira Cloud\
**Tags:** jql, jira-worklog, jira-cloud, rest-api\
**Created:** [May 24, 2021, 8:51am UTC](https://community.developer.atlassian.com/t/get-all-the-worklogs-for-the-issues-of-a-jql/48202 "2021-05-24T08:51:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dortiz](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@dortiz](https://community.developer.atlassian.com/u/dortiz)\
**Post date:** [May 24, 2021, 8:51am UTC](https://community.developer.atlassian.com/t/get-all-the-worklogs-for-the-issues-of-a-jql/48202/1 "2021-05-24T08:51:03Z")

</div>

Hi,

I am getting the issues from a jql through the REST service  
/rest/api/latest/search requesting the worklogs of the issues

```auto
{
    "jql":"project = LHC ORDER BY key ASC",
    "startAt":0,
    "maxResults":100,
    "fields":["id", "key", "summary", "description", "worklog"]
}

```

in the answer I get the paginated worklogs for the different issues, for example:

```auto
{
    "expand": "schema,names",
    "startAt": 0,
    "maxResults": 100,
    "total": 58,
    "issues": [
        {
            "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
            "id": "10013",
            "self": "https://dortizcloud.atlassian.net/rest/api/latest/issue/10013",
            "key": "LHC-1",
            "fields": {
                "summary": "Find bug",
                "description": null,
                "worklog": {
                    "startAt": 0,
                    "maxResults": 20,
                    "total": 33,
                    "worklogs": [...]
				}
            }

...

       	}
    ]
}

```

but sole returns the top 20.

Is there a way to tell it to return all worklogs or to make other calls to return the remaining worlogs?  
I want to avoid calling the service /rest/api/3/issue/{issueIdOrKey}/worklog, as it would be too slow to invoke it for all jql issues.

---

<div class="post-metadata">

**Author:** ![dmorrow](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/dmorrow/32/35895_2.png) [@dmorrow](https://community.developer.atlassian.com/u/dmorrow)\
**Post date:** [May 24, 2021, 12:00pm UTC](https://community.developer.atlassian.com/t/get-all-the-worklogs-for-the-issues-of-a-jql/48202/2 "2021-05-24T12:00:24Z")

</div>

Hi @dortiz ,

I don’t think you can specify the number of worklogs that the issue search query returns so you’d have to make subsequent calls to `/rest/api/3/issue/{issueKey}/worklog?startAt=20` in order to retrieve the other worklogs for each issue returned in the search. It seems that the `maxResults` query parameter defaults to a generous size, so you should only need 1 query per issue. I suspect you’re looking for something like a worklog centric query that would avoid the `n + 1` queries, but I don’t think this exists currently.

Regards,  
Dugald

---

<div class="post-metadata">

**Author:** ![dortiz](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@dortiz](https://community.developer.atlassian.com/u/dortiz)\
**Post date:** [May 24, 2021, 1:30pm UTC](https://community.developer.atlassian.com/t/get-all-the-worklogs-for-the-issues-of-a-jql/48202/3 "2021-05-24T13:30:37Z")

</div>

@dmorrow thanks for the reply.  
I suspected something like this, exactly, I want to avoid calls for each issue and be able to consult worklogs of different issues with a single call.

Currently, the service (/rest/api/latest/search) does not seem to return a maximum of comments

```auto
        "fields": {
                "summary": "Test Bug push applyFiltersRecursively",
                "description": null,
               "comment": {
                    "comments": [...
                     ],
                    "self": "https://dortizcloud.atlassian.net/rest/api/2/issue/10013/comment",
                    "maxResults": 47,
                    "total": 47,
                    "startAt": 0
                },
                "worklog": {...}

```

there is a maximum in the number of comments?
