Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

API call to list repos is only returning a subset of all repos in the project

Wayne Bridgman May 30, 2019

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.

1 answer

1 accepted

1 vote
Answer accepted
Evan Slaughter
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2019

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

Wayne Bridgman May 31, 2019

Thanks Evan, increasing the limit worked like a charm!

Evan Slaughter
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2019

Excellent - we're glad this information was able to help!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events