Forums

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

Bitbucket RepositoryService: findAll method returning only 1000 repositories

Anil Mishra
Contributor
December 3, 2019

I need to get all repositories from Bitbucket, and  I am using the RepositoryService .findAll()

repoService.findAll(new PageRequestImpl(0, 10000)

But it is returning only 1000 repos while in fileSystem there are more than that and I have specified the limit  for 10000.

Does this findAll ignores any repositories ?

How can I get all repositories?

 

Thanks,

Anil

1 answer

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2019

You will have to look at how many pages the response returns and then iterate on that. Have a look at PageRequest.

Anil Mishra
Contributor
December 5, 2019

Hi Mikael, Thanks for your reply.

I did use PageRequest, I used PageRequestImpl with below code snipped

repoService.findAll(new PageRequestImpl(0, 10000)

public PageRequestImpl (int start, int limit)

Constructs a new PageRequestImpl for retrieving a page with limit entries from the specified start index.

 

Am I doing anything wrong here? Can you suggest path forward on this.

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 5, 2019

There is a hard limit of 1000 by default on the page request, so unless you have changed that in the config file for bitbucket (forgot where it is) your 10000 is being ignored. For the scripts I created using the REST API I always check the pages returned to see if I have to do the call multiple times to get everything.

Like Move Work Forward likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events