Failed to get more than the maxResults limit for worklogs for an issue through REST API

Hello,
I have a simple app that retrieves worklogs for issues in JIRA.
I recently discovered through a client that there are missing worklogs if they are more than 20 for issue.
When I tried through postman I found that he was right and there was a limit
My request is something like that:
rest/api/3/search?jql=worklogDate >=2024-03-25&fields=worklog

and the resulting json is:

{
    "expand": "names,schema",
    "startAt": 0,
    "maxResults": 100,
    "total": 1,
    "issues": [
        {
            "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
            "id": "10015",
            "self": "ISSUE_NAME",
            "key": "ISSUE KEY",
            "fields": {
                "worklog": {
                    "startAt": 0,
                    **"maxResults": 20,**
                    "total": 32,
                    "worklogs": [
                        { //WORKLOGS}]
.....

How can I increase the max limit of the shown worklogs?

@DanielVelkov,

The short answer is that you can’t. Your client will need to page through the results.

The slightly longer answer is that the docs seem to suggest you can increase the number of worklogs returned:

  • maxResults is the maximum number of items that a page can return. Each operation can have a different limit for the number of items returned, and these limits may change without notice. To find the maximum number of items that an operation could return, set maxResults to a large number—for example, over 1000—and if the returned value of maxResults is less than the requested value, the returned value is the maximum.

However, experience (both empirical and in discussion with Jira engineers) has taught me that Atlassian has already set the default value of maxResults to the upper limit allowed. It’s probably a quick thing to check relative to the effort of implementing paging in your client. Just add the query parameter &maxResults=120. But, even if that does work, your worklogs will grow, and you’ll eventually need paging.

Hello Daniel,

Adding to Ian’s explanation, I believe you cannot increase the max 20 worklogs limit from that specific REST endpoint, the limit was added there for performance reasons in ~2017:

What you can do however is to use a different worklog-related endpoint, notably:

Both are cumbersome to use in some way - still, you might find them suitable for your specific use case. Presumably after adjusting app’s code logic.

1 Like

I did not get notified for your answer but fortunately I was able to solve it myself using the
/rest/api/3/issue/{issueIdOrKey}/worklog
link
Thanks, nevertheless

1 Like