如何用GitHub REST API列出企业账户所属组织及用户
使用GitHub REST API操作企业账户资源
列出企业账户所属的组织
调用GET /enterprises/{enterprise}/orgs接口,将{enterprise}替换为你的企业账户slug(即企业账户的短名称)。
请求示例(curl):
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/enterprises/ENTERPRISE/orgs
列出企业账户下的所有用户
调用GET /enterprises/{enterprise}/users接口,同样将{enterprise}替换为你的企业账户slug。
请求示例(curl):
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/enterprises/ENTERPRISE/users
- 操作前提:需拥有企业账户管理员权限,且访问令牌需包含
admin:enterprise或对应权限范围 - 分页支持:可通过
page和per_page参数控制返回结果的分页与单页数量
内容的提问来源于stack exchange,提问作者paradox
相关产品推荐
相关产品推荐

