REST API endpoints for enterprise team organizations
Use the REST API to create and manage organization assignments for enterprise teams in your GitHub enterprise.
About enterprise team organizations
メモ
現在、このエンドポイントは パブリック プレビュー 段階であり、変更される可能性があります。
この API ドキュメントは、GitHub Enterprise Cloud 上の Enterprise を対象としています。
Enterprise が GHE を利用していない Copilot Business である場合は、以前に共有された早期アクセス用ドキュメント リンクを参照してください。
これらのエンドポイントは、GET API の場合は read:enterprise スコープ、その他の API の場合は admin:enterprise であり、クラシック personal access tokens を利用する Enterprise チームの Enterprise に属する認証済みメンバーのみが使用できます。
これらのエンドポイントは、fine-grained personal access tokens または GitHub App アクセス トークンと互換性がありません。
GitHub により、チーム name から Enterprise チームの slug が生成され、ent: プレフィックスが追加されます。
Get organization assignments
Get all organizations assigned to an enterprise team
"Get organization assignments" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Get organization assignments" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
enterprise string 必須The slug version of the enterprise name. |
enterprise-team string 必須The slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| 名前, Type, 説明 |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
"Get organization assignments" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | An array of organizations the team is assigned to |
"Get organization assignments" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
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/teams/ENTERPRISE-TEAM/organizationsAn array of organizations the team is assigned to
Status: 200{
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"repos_url": "https://api.github.com/orgs/github/repos",
"events_url": "https://api.github.com/orgs/github/events",
"hooks_url": "https://api.github.com/orgs/github/hooks",
"issues_url": "https://api.github.com/orgs/github/issues",
"members_url": "https://api.github.com/orgs/github/members{/member}",
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization"
}Add organization assignments
Assign an enterprise team to multiple organizations.
"Add organization assignments" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Add organization assignments" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
enterprise string 必須The slug version of the enterprise name. |
enterprise-team string 必須The slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| 名前, Type, 説明 |
|---|
organization_slugs array of strings 必須Organization slug to assign the team to. |
"Add organization assignments" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | Successfully assigned the enterprise team to organizations. |
"Add organization assignments" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
curl -L \
-X POST \
-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/teams/ENTERPRISE-TEAM/organizations/add \
-d '{"organization_slugs":["github"]}'Successfully assigned the enterprise team to organizations.
Status: 200[
{
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"repos_url": "https://api.github.com/orgs/github/repos",
"events_url": "https://api.github.com/orgs/github/events",
"hooks_url": "https://api.github.com/orgs/github/hooks",
"issues_url": "https://api.github.com/orgs/github/issues",
"members_url": "https://api.github.com/orgs/github/members{/member}",
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization"
}
]Remove organization assignments
Unassign an enterprise team from multiple organizations.
"Remove organization assignments" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Remove organization assignments" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
enterprise string 必須The slug version of the enterprise name. |
enterprise-team string 必須The slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| 名前, Type, 説明 |
|---|
organization_slugs array of strings 必須Organization slug to unassign the team from. |
"Remove organization assignments" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
204 | Successfully unassigned the enterprise team from organizations. |
"Remove organization assignments" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
curl -L \
-X POST \
-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/teams/ENTERPRISE-TEAM/organizations/remove \
-d '{"organization_slugs":["github"]}'Successfully unassigned the enterprise team from organizations.
Status: 204Get organization assignment
Check if an enterprise team is assigned to an organization
"Get organization assignment" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Get organization assignment" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
enterprise string 必須The slug version of the enterprise name. |
enterprise-team string 必須The slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
org string 必須The organization name. The name is not case sensitive. |
"Get organization assignment" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | The team is assigned to the organization |
404 | The team is not assigned to the organization |
"Get organization assignment" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
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/teams/ENTERPRISE-TEAM/organizations/ORGThe team is assigned to the organization
Status: 200{
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"repos_url": "https://api.github.com/orgs/github/repos",
"events_url": "https://api.github.com/orgs/github/events",
"hooks_url": "https://api.github.com/orgs/github/hooks",
"issues_url": "https://api.github.com/orgs/github/issues",
"members_url": "https://api.github.com/orgs/github/members{/member}",
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization"
}Add an organization assignment
Assign an enterprise team to an organization.
"Add an organization assignment" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Add an organization assignment" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
enterprise string 必須The slug version of the enterprise name. |
enterprise-team string 必須The slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
org string 必須The organization name. The name is not case sensitive. |
"Add an organization assignment" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
201 | Successfully assigned the enterprise team to the organization. |
"Add an organization assignment" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
curl -L \
-X PUT \
-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/teams/ENTERPRISE-TEAM/organizations/ORGSuccessfully assigned the enterprise team to the organization.
Status: 201{
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"repos_url": "https://api.github.com/orgs/github/repos",
"events_url": "https://api.github.com/orgs/github/events",
"hooks_url": "https://api.github.com/orgs/github/hooks",
"issues_url": "https://api.github.com/orgs/github/issues",
"members_url": "https://api.github.com/orgs/github/members{/member}",
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization"
}Delete an organization assignment
Unassign an enterprise team from an organization.
"Delete an organization assignment" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Delete an organization assignment" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
enterprise string 必須The slug version of the enterprise name. |
enterprise-team string 必須The slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
org string 必須The organization name. The name is not case sensitive. |
"Delete an organization assignment" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
204 | Successfully unassigned the enterprise team from the organization. |
"Delete an organization assignment" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
curl -L \
-X DELETE \
-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/teams/ENTERPRISE-TEAM/organizations/ORGSuccessfully unassigned the enterprise team from the organization.
Status: 204