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

Using pagination for /2.0/repositories

Julien Delange December 16, 2022

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
Atlassian Team members are employees working across the company in a wide variety of roles.
December 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)

Julien Delange January 18, 2023

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
Atlassian Team members are employees working across the company in a wide variety of roles.
January 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)

Julien Delange January 19, 2023

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
AUG Leaders

Atlassian Community Events