Skip to main content
O controle de versão da API REST já foi feito. Para obter mais informações, confira "Sobre o controle de versão da API".

Pontos de extremidade de API REST para sincronização de equipe

Use a API REST para gerenciar as conexões entre as equipes do GitHub Enterprise Cloud e os grupos do IdP (provedor de identidade) externo.

Sobre a sincronização de equipes

Para usar esses pontos de extremidade, o usuário autenticado precisa ser um mantenedor da equipe ou um proprietário da organização associada à equipe. O token que você usa para efetuar a autenticação também deverá ser autorizado para uso com o provedor de IdP (SSO). Para obter mais informações, confira "Autorizar o uso de um token de acesso pessoal para uso com logon único SAML".

Você pode gerenciar os membros da equipe do GitHub Enterprise Cloud por meio do IdP com a sincronização de equipe. A sincronização de equipe precisa estar habilitada para que esses pontos de extremidade sejam usados. Para obter mais informações, confira "Gerenciando a sincronização da equipe para a sua organização".

Observação: esses pontos de extremidade não podem ser usados com o Enterprise Managed Users. Para saber mais sobre como gerenciar uma organização com usuários gerenciados, confira "Pontos de extremidade de API REST para grupos externos".

List IdP groups for an organization

Lists IdP groups available in an organization.

Tokens de acesso refinados para "List IdP groups for an organization"

Esse ponto de extremidade funciona com os seguintes tipos de token:

O token deve ter os seguintes conjuntos de permissões:

  • members:write

Parâmetros para "List IdP groups for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros de consulta
Nome, Tipo, Descrição
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Padrão: 30

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 ab will return results that begin with "ab".

Códigos de status de resposta HTTP para "List IdP groups for an organization"

Código de statusDescrição
200

OK

Exemplos de código para "List IdP groups for an organization"

Exemplo de solicitação

get/orgs/{org}/team-sync/groups
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

Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." }, { "group_id": "456", "group_name": "Octocat docs members", "group_description": "The people who make your octoworld come to life." } ] }

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.

Parâmetros para "List IdP groups for a team"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

team_slug string Obrigatório

The slug of the team name.

Códigos de status de resposta HTTP para "List IdP groups for a team"

Código de statusDescrição
200

OK

Exemplos de código para "List IdP groups for a team"

Exemplo de solicitação

get/orgs/{org}/teams/{team_slug}/team-sync/group-mappings
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

Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." }, { "group_id": "456", "group_name": "Octocat docs members", "group_description": "The people who make your octoworld come to life." } ] }

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.

Parâmetros para "Create or update IdP group connections"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

team_slug string Obrigatório

The slug of the team name.

Parâmetros do corpo
Nome, Tipo, Descrição
groups array of objects

The IdP groups you want to connect to a GitHub team. When updating, the new groups object will replace the original one. You must include any existing groups that you don't want to remove.

Nome, Tipo, Descrição
group_id string Obrigatório

ID of the IdP group.

group_name string Obrigatório

Name of the IdP group.

group_description string Obrigatório

Description of the IdP group.

Códigos de status de resposta HTTP para "Create or update IdP group connections"

Código de statusDescrição
200

OK

Exemplos de código para "Create or update IdP group connections"

Exemplo de solicitação

patch/orgs/{org}/teams/{team_slug}/team-sync/group-mappings
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

Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." }, { "group_id": "456", "group_name": "Octocat docs members", "group_description": "The people who make your octoworld come to life." } ] }

List IdP groups for a team (Legacy)

Deprecation Notice: This endpoint route is deprecated 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.

Parâmetros para "List IdP groups for a team (Legacy)"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
team_id integer Obrigatório

The unique identifier of the team.

Códigos de status de resposta HTTP para "List IdP groups for a team (Legacy)"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "List IdP groups for a team (Legacy)"

Exemplo de solicitação

get/teams/{team_id}/team-sync/group-mappings
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

Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." }, { "group_id": "456", "group_name": "Octocat docs members", "group_description": "The people who make your octoworld come to life." } ] }

Create or update IdP group connections (Legacy)

Deprecation Notice: This endpoint route is deprecated 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.

Parâmetros para "Create or update IdP group connections (Legacy)"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
team_id integer Obrigatório

The unique identifier of the team.

Parâmetros do corpo
Nome, Tipo, Descrição
groups array of objects Obrigatório

The IdP groups you want to connect to a GitHub team. When updating, the new groups object will replace the original one. You must include any existing groups that you don't want to remove.

Nome, Tipo, Descrição
group_id string Obrigatório

ID of the IdP group.

group_name string Obrigatório

Name of the IdP group.

group_description string Obrigatório

Description of the IdP group.

id string
name string
description string
synced_at string

Códigos de status de resposta HTTP para "Create or update IdP group connections (Legacy)"

Código de statusDescrição
200

OK

403

Forbidden

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Create or update IdP group connections (Legacy)"

Exemplo de solicitação

patch/teams/{team_id}/team-sync/group-mappings
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

Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." } ] }