Enterprise チーム メンバーシップの REST API エンドポイント
REST API を使って、GitHub Enterprise 内の Enterprise チームのメンバーシップを作成および管理します。
Enterprise チーム メンバーについて
メモ
現在、このエンドポイントは パブリック プレビュー 段階であり、変更される可能性があります。
この 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: プレフィックスが追加されます。
List members in an enterprise team
Lists all team members in an enterprise team.
"List members in an enterprise team" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"List members in an enterprise team" のパラメーター
| 名前, 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: |
"List members in an enterprise team" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | OK |
"List members in an enterprise team" のコード サンプル
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/membershipsResponse
Status: 200[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Bulk add team members
Add multiple team members to an enterprise team.
"Bulk add team members" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Bulk add team members" のパラメーター
| 名前, 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, 説明 |
|---|
usernames array of strings 必須The GitHub user handles to add to the team. |
"Bulk add team members" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | Successfully added team members. |
"Bulk add team members" のコード サンプル
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/memberships/add \
-d '{"usernames":["monalisa","octocat"]}'Successfully added team members.
Status: 200[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Bulk remove team members
Remove multiple team members from an enterprise team.
"Bulk remove team members" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Bulk remove team members" のパラメーター
| 名前, 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, 説明 |
|---|
usernames array of strings 必須The GitHub user handles to be removed from the team. |
"Bulk remove team members" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | Successfully removed team members. |
"Bulk remove team members" のコード サンプル
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/memberships/remove \
-d '{"usernames":["monalisa","octocat"]}'Successfully removed team members.
Status: 200[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Get enterprise team membership
Returns whether the user is a member of the enterprise team.
"Get enterprise team membership" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Get enterprise team membership" のパラメーター
| 名前, 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. |
username string 必須The handle for the GitHub user account. |
"Get enterprise team membership" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | User is a member of the enterprise team. |
"Get enterprise team membership" のコード サンプル
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/memberships/USERNAMEUser is a member of the enterprise team.
Status: 200{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}Add team member
Add a team member to an enterprise team.
"Add team member" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Add team member" のパラメーター
| 名前, 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. |
username string 必須The handle for the GitHub user account. |
"Add team member" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
201 | Successfully added team member |
"Add team member" のコード サンプル
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/memberships/USERNAMESuccessfully added team member
Status: 201{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}Remove team membership
Remove membership of a specific user from a particular team in an enterprise.
"Remove team membership" のきめ細かいアクセス トークン
このエンドポイントは、GitHub アプリのユーザー アクセス トークン、GitHub アプリのインストール アクセス トークン、またはきめ細かい個人用アクセス トークンでは機能しません。
"Remove team membership" のパラメーター
| 名前, 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. |
username string 必須The handle for the GitHub user account. |
"Remove team membership" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
204 | No Content |
403 | Forbidden |
"Remove team membership" のコード サンプル
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/memberships/USERNAMEResponse
Status: 204