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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,464,134
Community Members
 
Community Events
176
Community Groups

Using pagination for /2.0/repositories

We are maintaining a Bitbucket app. We have customer complaints that we are not showing all repositories. It seems this is a bug in the Bitbucket API.

The pagination seems broken. The request

https://api.bitbucket.org/2.0/repositories?page=1&pagelen=10&role=owner

returns the same result than

https://api.bitbucket.org/2.0/repositories?page=2&pagelen=10&role=owner

In fact, changing the number of page in the request parameter does not seem to have any effect.

There are the results from an impacted customer:

Page 1

$curl -H "Authorization: JWT <jwt>" 'https://api.bitbucket.org/2.0/repositories?page=1&pagelen=10&role=owner' | jq -r ".values[].slug"

project1
project2

Page 2

$ curl -H "Authorization: JWT <jwt>" 'https://api.bitbucket.org/2.0/repositories?page=2&pagelen=10&role=owner' | jq -r ".values[].slug"

project1
project2

 

The correct behavior should be to have a different list of values for each page.

 

Am I doing anything wrong?

 

Note: it would be really cool to be able to write content with markdown on this forum.

1 answer

0 votes
Ben Atlassian Team Dec 19, 2022

Hey Julien,

I have tested this from my end using AppPassword as the authentication method and was unable to reproduce this issue - I am able to see a list of 10 repositories belonging to my workspaceID and viewing page 2 shows the remaining 4 repositories attributed to my workspaceID:

curl -X GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspaceID}?page=1&pagelen=10&role=owner' \
--user {username}:{AppPassword}

curl -X GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspaceID}?page=2&pagelen=10&role=owner' \
--user {username}:{AppPassword}

NOTE: you will need to remove the curly braces and replace workspaceID, username and AppPassword with actual values.

Can you try the above and let me know how this goes?

Cheers!

- Ben (Bitbucket Cloud Support)

Hi @Ben and sorry for the late reply. We do not have the application user or their password. We have a Bitbucket App and only authenticate through a JWT. This is how Bitbucket Applications authenticate (link to Bitbucket doc).

 

To this day, we will have the issue and more customers complained.

Ben Atlassian Team Jan 19, 2023

Hi @Julien Delange 

My apologies - I have attempted to re-create your environment by creating a test app, and running a NodeJS server with Ngrok to be able to generate a JWT but I have been unsuccessful. I do not have much knowledge of NodeJS code so this is probably the main issue I'm facing :/

To avoid any further delay, I would suggest reaching out to our developer community as they would be better equipped to assist you further:
https://community.developer.atlassian.com/c/bitbucket-development/bitbucket-cloud/13

Cheers!

- Ben (Bitbucket Cloud Support)

Thank you! I created the following error (for traceability of folks that want to keep track of the issue) https://community.developer.atlassian.com/t/using-pagination-for-2-0-repositories/65321

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events