Get all the worklogs for the issues of a jql

Hi,

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

{
    "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:

{
    "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.

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

@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

        "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?