Greetings Atlassian,
According to the pagination documentation, the `next` property of a paginated collection is the recommended way to 'loop' through your collections.
Expected
The last page of a collection should omit the value of `next` to indicate this is the last page, as described in the documentation.
Lack of a next link in the response indicates the end of the collection.
Actual
On the last page of a collection, the `next` value actually links back to the first page:
{
"page": 2,
...
"size": 38,
"next": "http://bitbucket-pipelines.prod.public.atl-paas.net/rest/1.0/accounts/{UUID}/repositories/{REPO_UUID}/variables?page=3&pagelen=10",
"previous": "http://bitbucket-pipelines.prod.public.atl-paas.net/rest/1.0/accounts/{UUID}/repositories/{REPO_UUID}/variables?page=1&pagelen=10",
"pagelen": 10
}Work around
The workaround is to of course generate your own URL, but the whole purpose is to not have to do this:
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.