Pagination is not working for pipelines endpoint in API 2

Issue #13806 new
Theodora Boudale
staff created an issue

Summary

Pagination is not working for pipelines endpoint in API 2

Steps to Reproduce

  1. A repo with more than 10 Pipelines builds is needed to reproduce
  2. Execute the following curl command:
curl --request GET --user username:password https://api.bitbucket.org/2.0/repositories/<username>/<repo-slug>/pipelines/

Expected Results

The output returns a paginated collection with a "next" field, including the link to the next page

Actual Results

The "next" field is missing from the output.

Workaround

Add a query parameter of the page, e.g. if you want to access the 2nd page:

curl --request GET --user username:password https://api.bitbucket.org/2.0/repositories/<username>/<repo-slug>/pipelines/?page=2

Comments (7)

  1. Matt Ryall staff

    This is actually quite hard to fix, given the architecture of how Pipelines serves its API through api.bitbucket.org, so we're not planning on fixing it at the moment.

    The workaround is as documented in the issue - pass the page as a query parameter, rather than using the next url. Not quite as nice, but still workable.

  2. Troels Nilsson

    You should probably add a note to the documentation about this, since it specifically states to not do this. From https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination:

    However, clients are not expected to construct URLs themselves by manipulating the page number query parameter. Instead, the response contains a link to the next page. This link should be treated as an opaque location that is not to be constructed by clients or even assumed to be predictable. The only contract around the next link is that it will return the next chunk of results.

    Lack of a next link in the response indicates the end of the collection.

  3. Log in to comment