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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.