用于团队同步的 REST API 终结点
使用 REST API 管理 GitHub Enterprise Cloud 团队与外部标识提供者 (IdP) 组之间的连接。
关于团队同步
要使用这些终结点,经过身份验证的用户必须是团队维护员或与团队关联的组织所有者。 用于身份验证的令牌还需要获得授权才能与 IdP (SSO) 提供程序一起使用。 有关详细信息,请参阅“授权用于 SAML 单点登录的个人访问令牌”。
可以通过 IdP 使用团队同步管理 GitHub Enterprise Cloud 团队成员。 必须启用团队同步才能使用这些终结点。 有关详细信息,请参阅“管理组织中的团队同步”。
注意:这些终结点不能与 Enterprise Managed Users 一起使用。 若要详细了解如何管理 具有托管用户的组织,请参阅“外部组的 REST API 终结点”。
List IdP groups for an organization
Lists IdP groups available in an organization.
“List IdP groups for an organization”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Members" organization permissions (write)
“List IdP groups for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page string Page token |
q string Filters the results to return only those that begin with the value specified by this parameter. For example, a value of |
“List IdP groups for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List IdP groups for an organization”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at 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/orgs/ORG/team-sync/groups
Response
List IdP groups for a team
List IdP groups connected to a team on GitHub Enterprise Cloud.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Note
You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/team-sync/group-mappings
.
“List IdP groups for a team”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
team_slug string 必须The slug of the team name. |
“List IdP groups for a team”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List IdP groups for a team”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at 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/orgs/ORG/teams/TEAM_SLUG/team-sync/group-mappings
Response
Create or update IdP group connections
Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty groups
array will remove all connections for a team.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Note
You can also specify a team by org_id
and team_id
using the route PATCH /organizations/{org_id}/team/{team_id}/team-sync/group-mappings
.
“Create or update IdP group connections”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
team_slug string 必须The slug of the team name. |
名称, 类型, 说明 | ||||
---|---|---|---|---|
groups array of objects The IdP groups you want to connect to a GitHub team. When updating, the new | ||||
Properties of |
名称, 类型, 说明 |
---|
group_id string 必须ID of the IdP group. |
group_name string 必须Name of the IdP group. |
group_description string 必须Description of the IdP group. |
“Create or update IdP group connections”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Create or update IdP group connections”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/team-sync/group-mappings \
-d '{"groups":[{"group_id":"123","group_name":"Octocat admins","group_description":"string"}]}'
Response
List IdP groups for a team (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new List IdP groups for a team
endpoint.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
List IdP groups connected to a team on GitHub Enterprise Cloud.
“List IdP groups for a team (Legacy)”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
team_id integer 必须The unique identifier of the team. |
“List IdP groups for a team (Legacy)”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
“List IdP groups for a team (Legacy)”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at 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/teams/TEAM_ID/team-sync/group-mappings
Response
Create or update IdP group connections (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Create or update IdP group connections
endpoint.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty groups
array will remove all connections for a team.
“Create or update IdP group connections (Legacy)”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
team_id integer 必须The unique identifier of the team. |
名称, 类型, 说明 | |||||||
---|---|---|---|---|---|---|---|
groups array of objects 必须The IdP groups you want to connect to a GitHub team. When updating, the new | |||||||
Properties of |
名称, 类型, 说明 |
---|
group_id string 必须ID of the IdP group. |
group_name string 必须Name of the IdP group. |
group_description string 必须Description of the IdP group. |
id string |
name string |
description string |
synced_at
string “Create or update IdP group connections (Legacy)”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
403 | Forbidden |
422 | Validation failed, or the endpoint has been spammed. |
“Create or update IdP group connections (Legacy)”的示例代码
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
请求示例
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/teams/TEAM_ID/team-sync/group-mappings \
-d '{"groups":[{"group_id":"123","group_name":"Octocat admins","description":"The people who configure your octoworld.","group_description":"string"}]}'
Response