Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Bug: pagination next object does not "lack" on the last page

Greetings Atlassian,

According to the pagination documentation, the `next` property of a paginated collection is the recommended way to 'loop' through your collections.


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.


On the last page of a collection, the `next` value actually links back to the first page:

"page": 2,
"size": 38,
"next": "{UUID}/repositories/{REPO_UUID}/variables?page=3&pagelen=10",
"previous": "{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.

1 answer

1 accepted

1 vote
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 01, 2023

Hi Sander,

This looks like a bug with the repository variables endpoint. There are actually two bugs:

The first one is that the links for "previous" and "next" are invalid, as you can see in the sample response you posted here. This bug is tracked in the following bug report:

The "next" field is indeed present even when there is no next page. I created a bug report for this here:

If you have less than 100 repository variables, you can use ?pagelen=100 in the API call (100 is the maximum allowed value for pagelen for this endpoint). All variables will then be returned in one page, and the "next" field will not be included in the response.

Kind regards,

Thanks for dissecting the scenario in smaller issues, and link/creating the appropriate tickets :)

The use-case is needed for an infinite amount of results (used for a Terraform Provider), as such I will likely construct my own pagination URL increasing the page parameter in every iteration.

Like Theodora Boudale likes this

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events