如何在Github上列出企业账户拥有的组织

问题描述 投票:0回答:1

如何使用 Rest API 列出 Github 企业帐户拥有的组织。 Rest API 文档 - https://docs.github.com/en/enterprise-cloud@latest/rest/quickstart?apiVersion=2022-11-28.

检查了他们的文档,我找不到列出 github 企业帐户拥有的组织的 API。另外,我需要 API 来列出企业帐户中存在的所有用户。

github github-api
1个回答
0
投票

可以通过 GraphQL API 检索 Github Enterprise Cloud 或服务器中的组织列表。没有 REST API 端点来检索此数据。

来源:Github 的 Enterprise GraphQL 文档

您可以使用企业帐户 API 和审核日志 API,它们仅作为 GraphQL API 提供。

这是一个示例 GraphQL 查询,可以检索企业内的组织列表。

query listOrganizationWithinEnterprise($enterprise_slug: String!) {
  enterprise(slug: $enterprise_slug) {
    name
    organizations(first:100){
      nodes{
        name
        ... on Organization{
          login
          name
        }
      }
    }
  }
}

使用变量部分

{'enterprise_slug': 'your_enterprise_name_here'}

© www.soinside.com 2019 - 2024. All rights reserved.