Is there a limit to the number of "items" returned from a REST API call?

brant_brisson March 4, 2020

I have made the following API call (see below) and receive a successful response. 

API Call --> https://{instance}.atlassian.net/rest/api/3/issue/DEP-300/changelog

I am parsing the JSON and would like to know an answer to the following questions:

  1. Question 1--> Is there is a limit to the number of "items" returned for each of the "values" array returned (see print screen attached)? 
  2. Question 2--> Are there any pagination parameters for the "items" array (it seems not)?

It appears that when more than one change is recorded for an "issue" at the same time, both are recorded in an "items" array and indexed by integer.

Unlike the "values" array, which has "maxResults", "startAt", "total", and "isLast", the "items" array does not see, to have 'pagination' parameters.

Jira_issue_changelog_values_items.png

2 answers

0 votes
David_Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 4, 2020

There is no limit to the number of items returned. By default, it's 50, but you can set maxResults to 100 to get more. You used to able to use maxResults up to 1,000, but that got reduced to 100 some time ago. Read JIRACloud-67570 for more information on why that changed.

With Jira Cloud, if you have more than 100 items to return, you have to iterate through them in batches using startAt

The pagination of the issues in the array is by ID, in ascending order. If you want them returned in a different order or based on another field, use the orderBy value. Read the pagination section of the Jira Cloud REST API docs for more information.

Sorry, but I don't know if the pagination of the Item sub-array can be changed or what the order is, as it's not described in the documentation. From your example, there are only two values inside, and they are in alphabetic order, so I guess that's all there is.

brant_brisson April 6, 2020

Thanks for the answer David, but as stated above, "Unlike the "values" array, which has "maxResults", "startAt", "total", and "isLast", the "items" array does not see, to have 'pagination' parameters."

Do you know for a fact that the pagination parameters are available for the "Items" array?

David_Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 6, 2020

Well, rather than conjecture any further, I thought I'd give it a try myself.... and found out that querying the issue changelog isn't available for Jira Server, which I'm using, only Jira Cloud. Yet another difference between the two :(

When I read through this section of the REST API documentation for Jira Cloud on querying the issue changelog, it does say that the returned results are paginated, but it doesn't say that the query supports using orderBy, It just says the query "Returns a list of recent updates to an issue, sorted by date, starting from the most recent"

Sorry. I think I've misled you there. It looks like you'll have to do the sorting or 'pagination' of the contents of both the Values array and the Items sub-array yourself in your code.

0 votes
David_Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 4, 2020

Since you are using Jira Cloud, the limit is 100 items. By default, the number of items is limited to 50, which you can increase to 100 via setting maxResults. If you have more than 100 items, you have to iterate through them in batches. Refer to JIRACloud-6750 for a history of the decision to limit maxResuts to 100 items.

As for pagination of the objects within the array, they are returned in the order of the issue ID, ascending, by default. If you want them returned in a different order, read this article on how to use orderBy to choose what field to order by and if ascending or descending.

Suggest an answer

Log in or Sign up to answer