Hi All,
I am trying to iterate through my projects (on-premise Bitbucket) and list all repos. The below command will work for all projects bar one. For one project it stubbornly refuses to list all of the repos in the project. It only lists 25 of 52 projects. I have admin access at the project level.
curl -s -u username:password --request GET https://bitbucket.subdomain.co.uk/rest/api/1.0/projects/PROJNAME/repos | jq --raw-output '.values[].links.clone[].href' | grep https
Any thoughts on what may be causing this anomaly would be very welcome.
Hi Wayne,
It sounds like you may just be hitting the default page limit for results returned by the REST API, which is 25.
At the end of the resulting cURL request - if you remove your grep portion, you should see that there are two values: "start" and "nextPageStart". In addition, to confirm this, you can also check the start of the results to see if the "size" and "limit" values are both 25, and the "isLastPage" value is false.
To get all of the results, you can either iterate through the results page by page - or you can look to raise the limit of the number of results returned:
Then of course, both of these can be combined by appending a '&' between the different query parameters in your URL. Ex: https://bitbucket.subdomain.co.uk/rest/api/1.0/projects/PROJNAME/repos?limit=50&start=50
For more information on paging within the REST API, we recommend checking out the Bitbucket REST API documentation here.
Let us know if this information helps.
Thanks,
Evan Slaughter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Excellent - we're glad this information was able to help!
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.