Pagination on new /refs API endpoint not working properly (BB-15267)

Issue #12131 resolved
Steve Muskiewicz
created an issue

As suggested in issue 12051, I have been attempting to use the undocumented v2.0 API /refs endpoint to fetch tags and branches from a repo that has a lot of them.

The branch and tag data returned by this endpoint looks fine, however the pagination of the results is not working properly. The "pagelen" field always appears to be returning a value of 10 regardless of the size of the "values" list (which itself seems to be correct), and also the "next" field is being returned even in cases where there is no additional branch/tag data remaining.

(In this case, calling the "next" URL returns a result that (correctly) has an empty "values" but yet still includes the "next" field. So I currently don't have any way to programmatically determine when the end of the result set has been reached.)

Comments (6)

  1. Marcus Bertrand staff

    The pagelen is a configurable parameter to the API that controls the number of results per page. Its default is 10. If you want to get more than 10 results per page, you can add it as a query parameter to the URL to change it like &pagelen=20. To determine the number of possible pages, divide the pagelen into the size field which should be present on every page. Finally, once you reach the end of the list, you shouldn't see a next parameter any longer.

    Sorry for the time to response on this one. But the current state of the refs API works as expected.

  2. Log in to comment