Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get all private repos owned by team.

Hello,

I would like to ask you, how can I get all repos owned by team through bitbucket API ?

I tested a little bit API and I was able to get all repos(public/private) for some user through this API: 

https://api.bitbucket.org/2.0/repositories/{user}

 And now my scenario is following:

I have defined team (Team1) and for this team we have aproximatelly 30 private repos.

So I have decided to define some common user - admin who is assigned to this team and get all repos through this team member. He is not owner he is only member of team. So how can I achieved  that I will be able to see all team repos without to make this user owner of these repos. Have you got any API where I can get these repos in combination with Team and User ? Or I need to make this user owner of these repos and get them as in example above ? 

Thanks

 

Lukas

1 answer

0 votes
theMightyOne Atlassian Team Apr 11, 2018

Hi Lukas,

A team member with at least 'read' access to the team repos should be able to retrieve all repos from a team using the Bitbucket REST API -- the user does not need to be an admin/owner of the repos in the team.

So, if a user who is a member of the team uses the following API:

https://api.bitbucket.org/2.0/repositories/{TeamName}

the user will get all the team repos which he has at least 'read' permissions on. 

-Vivian

Hi Vivian,

it helps. Thank you. But now I have another problem and that is how to get all branches for the current repository. If I have 'team', 'user' how can I get all branches ? I tried to used this api '/repositories/{username}/{repo_slug}/refs/branches' and as username I used name of my user who has permissions to read repositories and as repo_slug the name of the current repo.

 

Thanks

 

Lukas

I have tried following but not getting any repository list.

https://api.bitbucket.org/2.0/repositories/{TeamName}
Like Patrick Melo likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,826 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you