Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a full list of repositories that a user is allowed to access?

I have found bitbucket api like:

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

But this link return 301 status (moved permanently to !api/2.0/repositories/{teamname}).

Ok, but this one returns status 200 with zero repositories.

I provide two parameters as user and password, but nothing seems changed.

So, can anybody answer how to get full list of private repositories that allowed to specific user?

like image 942
gaussblurinc Avatar asked May 06 '14 09:05

gaussblurinc


People also ask

How do I list all repositories in Bitbucket?

Instead, you should always use https://api.bitbucket.org. Show activity on this post. "Returns a paginated list of all repositories owned by the specified account or UUID." according to the doco.

How do I see repository permissions in Bitbucket?

Go to Settings > Permissions for the repository. Click in the Add Users or Add Groups fields in the relevant section to search for, and bulk add, users or groups. Choose a permission from the drop-down list, then click Add.

How do I give permission to repository?

Update user or group access for a repository To update group access on a repository, select the repository > select Repository settings > select user and group access > select the Permission dropdown associated with the user or group > select the new permission level you want to grant to the group for this repository.

How do I give someone access to my Bitbucket repository?

User access on existing repositories Click Repository settings in the left sidebar navigation of the Bitbucket repository. Click User and group access on the left sidebar navigation. Select the Add members button. Enter the Bitbucket user's name or email address in the text box.


1 Answers

Atlassian Documentation - Repositories Endpoint provides a detail documentation on how to access the repositories.

The URL mentioned in bitbucket to GET a list of repositories for an account is:

GET https://api.bitbucket.org/2.0/repositories/{owner}

If you use the above URL it always retrieves the repositories where you are the owner. In order to retrieve full list of repositories that the user is member of, you should call:

GET https://api.bitbucket.org/2.0/repositories?role=member

You can apply following set of filters for role based on your needs.

To limit the set of returned repositories, apply the role=[owner|admin|contributor|member] parameter where the roles are:

  • owner: returns all repositories owned by the current user.
  • admin: returns repositories to which the user has explicit administrator access.
  • contributor: returns repositories to which the user has explicit write access.
  • member: returns repositories to which the user has explicit read access.

Edit-1:
You can make use of Bitbucket REST browser for testing the request/response.(discontinued)

like image 197
blizzard Avatar answered Sep 28 '22 00:09

blizzard