Skip to main content
我们经常发布文档更新,此页面的翻译可能仍在进行中。 有关最新信息,请访问英语文档

外部组

使用 REST API 查看可用于组织的外部标识提供者组,并管理组织中外部组和团队之间的连接。

关于外部组

要使用这些终结点,经过身份验证的用户必须是团队维护员或与团队关联的组织所有者。

Get an external group

适用于 GitHub Apps

Displays information about the specific group's usage. Provides a list of the group's external members as well as a list of teams that this group is connected to.

You can manage team membership with your identity provider using Enterprise Managed Users for GitHub Enterprise Cloud. For more information, see "GitHub's products" in the GitHub Help documentation.

“Get an external group”的参数

标头
名称, 类型, 说明
acceptstring

Setting to application/vnd.github+json is recommended.

路径参数
名称, 类型, 说明
orgstring必选

The organization name. The name is not case sensitive.

group_idinteger必选

The unique identifier of the group.

“Get an external group”的 HTTP 响应状态代码

状态代码说明
200

OK

“Get an external group”的示例代码

get/orgs/{org}/external-group/{group_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/orgs/ORG/external-group/GROUP_ID

Response

Status: 200
{ "group_id": "123", "group_name": "Octocat admins", "updated_at": "2021-01-24T11:31:04-06:00", "teams": [ { "team_id": 1, "team_name": "team-test" }, { "team_id": 2, "team_name": "team-test2" } ], "members": [ { "member_id": 1, "member_login": "mona-lisa_eocsaxrs", "member_name": "Mona Lisa", "member_email": "mona_lisa@github.com" }, { "member_id": 2, "member_login": "octo-lisa_eocsaxrs", "member_name": "Octo Lisa", "member_email": "octo_lisa@github.com" } ] }

List external groups in an organization

适用于 GitHub Apps

Lists external groups available in an organization. You can query the groups using the display_name parameter, only groups with a group_name containing the text provided in the display_name parameter will be returned. You can also limit your page results using the per_page parameter. GitHub Enterprise Server generates a url-encoded page token using a cursor value for where the next page begins. For more information on cursor pagination, see "Offset and Cursor Pagination explained."

You can manage team membership with your identity provider using Enterprise Managed Users for GitHub Enterprise Cloud. For more information, see "GitHub's products" in the GitHub Help documentation.

“List external groups in an organization”的参数

标头
名称, 类型, 说明
acceptstring

Setting to application/vnd.github+json is recommended.

路径参数
名称, 类型, 说明
orgstring必选

The organization name. The name is not case sensitive.

查询参数
名称, 类型, 说明
per_pageinteger

The number of results per page (max 100).

默认: 30

pageinteger

Page token

display_namestring

Limits the list to groups containing the text in the group name

“List external groups in an organization”的 HTTP 响应状态代码

状态代码说明
200

OK

“List external groups in an organization”的示例代码

get/orgs/{org}/external-groups
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/orgs/ORG/external-groups

Response

Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "updated_at": "2021-01-24T11:31:04-06:00" }, { "group_id": "456", "group_name": "Octocat docs members", "updated_at": "2021-03-24T11:31:04-06:00" } ] }

List a connection between an external group and a team

适用于 GitHub Apps

Lists a connection between a team and an external group.

You can manage team membership with your identity provider using Enterprise Managed Users for GitHub Enterprise Cloud. For more information, see "GitHub's products" in the GitHub Help documentation.

“List a connection between an external group and a team”的参数

标头
名称, 类型, 说明
acceptstring

Setting to application/vnd.github+json is recommended.

路径参数
名称, 类型, 说明
orgstring必选

The organization name. The name is not case sensitive.

team_slugstring必选

The slug of the team name.

“List a connection between an external group and a team”的 HTTP 响应状态代码

状态代码说明
200

OK

“List a connection between an external group and a team”的示例代码

get/orgs/{org}/teams/{team_slug}/external-groups
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/external-groups

Response

Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "updated_at": "2021-01-24T11:31:04-06:00" }, { "group_id": "456", "group_name": "Octocat docs members", "updated_at": "2021-03-24T11:31:04-06:00" } ] }

Update the connection between an external group and a team

Creates a connection between a team and an external group. Only one external group can be linked to a team.

You can manage team membership with your identity provider using Enterprise Managed Users for GitHub Enterprise Cloud. For more information, see "GitHub's products" in the GitHub Help documentation.

“Update the connection between an external group and a team”的参数

标头
名称, 类型, 说明
acceptstring

Setting to application/vnd.github+json is recommended.

路径参数
名称, 类型, 说明
orgstring必选

The organization name. The name is not case sensitive.

team_slugstring必选

The slug of the team name.

正文参数
名称, 类型, 说明
group_idinteger必选

External Group Id

“Update the connection between an external group and a team”的 HTTP 响应状态代码

状态代码说明
200

OK

“Update the connection between an external group and a team”的示例代码

patch/orgs/{org}/teams/{team_slug}/external-groups
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/external-groups \ -d '{"group_id":123}'

Response

Status: 200
{ "group_id": "123", "group_name": "Octocat admins", "updated_at": "2021-01-24T11:31:04-06:00", "teams": [ { "team_id": 1, "team_name": "team-test" }, { "team_id": 2, "team_name": "team-test2" } ], "members": [ { "member_id": 1, "member_login": "mona-lisa_eocsaxrs", "member_name": "Mona Lisa", "member_email": "mona_lisa@github.com" }, { "member_id": 2, "member_login": "octo-lisa_eocsaxrs", "member_name": "Octo Lisa", "member_email": "octo_lisa@github.com" } ] }

Remove the connection between an external group and a team

Deletes a connection between a team and an external group.

You can manage team membership with your IdP using Enterprise Managed Users for GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.

“Remove the connection between an external group and a team”的参数

标头
名称, 类型, 说明
acceptstring

Setting to application/vnd.github+json is recommended.

路径参数
名称, 类型, 说明
orgstring必选

The organization name. The name is not case sensitive.

team_slugstring必选

The slug of the team name.

“Remove the connection between an external group and a team”的 HTTP 响应状态代码

状态代码说明
204

No Content

“Remove the connection between an external group and a team”的示例代码

delete/orgs/{org}/teams/{team_slug}/external-groups
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/external-groups

Response

Status: 204