如何获取允许用户访问的存储库的完整列表? [英] How to get a full list of repositories that a user is allowed to access?

查看:94
本文介绍了如何获取允许用户访问的存储库的完整列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了bitbucket api,例如:

I have found bitbucket api like:

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

但是此链接返回301状态(永久移动到!api / 2.0 / repositories / {teamname} )。

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

好,但是此状态返回状态200,存储库为零。

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

我提供了两个参数,分别为 user password ,但似乎没有变化。

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?

推荐答案

Atlassian文档-存储库端点提供了一个有关如何访问存储库的详细文档。

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

bitbucket中提到的用于获取帐户存储库列表的URL是:

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

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

如果您使用上面的URL始终会检索您作为所有者的存储库。为了检索用户所属的存储库的完整列表,您应该调用:

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.


要限制返回的存储库集,请应用
role = [owner | admin | contributor | member ]参数,其中角色是:

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


  • 所有者:返回当前用户拥有的所有存储库。

  • 管理员:返回用户具有明确
    管理员访问权限的存储库。

  • 贡献者:返回用户具有显式写访问权限的存储库。

  • 成员:返回用户具有显式读
    访问权限的存储库。
  • li>
  • 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:

您可以使用<一个href = http://restbrowser.bitbucket.org/ rel = noreferrer>用于测试请求/响应的Bitbucket REST浏览器。(已停产)

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

这篇关于如何获取允许用户访问的存储库的完整列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆