Find all repositories a given user has access to

Hello,

I have done a fair amount of digging on this topic already - it appears to me that, given the current 2.0 api, I cannot ask the API to give me all repositories that a username or user id have read or write access to.

The larger problem I am trying to solve is trying to find all commits a user has made in a workspace. The only current way I can see how to do this is to go to each repository, grab all the commits, and then filter by my user. My workspace has many repositories so this is not feasible, so I have the idea to limit the scope of the initial request to simply repositories that the user has write access to, and then go through the commits for each of those.

Is there a way to accomplish either of these things?

Thanks,
Chris

2 Likes

I’m also experiencing this issue. Given my app’s account permission, I want to get all repositories. I don’t see a way of doing that.

Hi @ChrisRigmaiden

Deep apologies for such a late reply.

Here is a sample command of how to retrieve all repos a user has access to:

curl --location --request GET 'https://api.bitbucket.org/2.0/repositories' \
--header 'Authorization: Basic....'

Here, I am using basic authentication, which we do not recommend except in your automation scripts. Please use Oauth 2 instead, about which you can read the details here.

There is an API to get all commits of a repo in a workspace. I think this will serve your purpose.

Feel free to reach out is you have any questions.

Thanks.