Skip to main content

Sincronização de equipes

A API de sincronização de equipe permite que você gerencie as conexões entre as equipes de GitHub e os grupos de provedor de identidade externo (IdP).

Sobre a API de sincronização da equipe

Para usar esta API, o usuário autenticado deve ser um mantenedor de 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, consulte "Autorizando um token de acesso pessoal para uso com uma organização de logon único SAML".

Você pode gerenciar os integrantes da equipe do GitHub através do seu IdP com a sincronização de equipe. A sincronização de equipe deve estar habilitada para usar a API de sincronização de equipe. Para obter mais informações, consulte "Sincronizar equipes entre seu provedor de identidade e o GitHub".

Observação: A API de sincronização de equipe não pode ser usada com Enterprise Managed Users. Para saber mais sobre como gerenciar um organization with managed users, consulte "API de grupos externos".

List IdP groups for an organization

Works with GitHub Apps

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 available in an organization. You can limit your page results using the per_page parameter. GitHub 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."

Parâmetros

Headers
Nome, Tipo, Descrição
acceptstring

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

Path parameters
Nome, Tipo, Descrição
orgstringObrigatório

The organization name. The name is not case sensitive.

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

The number of results per page (max 100).

Padrão: 30

pagestring

Page token

HTTP response status codes

Status codeDescrição
200

OK

Amostras de código

get/orgs/{org}/team-sync/groups
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: token <TOKEN>" \ 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

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.

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

Headers
Nome, Tipo, Descrição
acceptstring

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

Path parameters
Nome, Tipo, Descrição
orgstringObrigatório

The organization name. The name is not case sensitive.

team_slugstringObrigatório

The slug of the team name.

HTTP response status codes

Status codeDescrição
200

OK

Amostras de código

get/orgs/{org}/teams/{team_slug}/team-sync/group-mappings
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: token <TOKEN>" \ 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

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.

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

Headers
Nome, Tipo, Descrição
acceptstring

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

Path parameters
Nome, Tipo, Descrição
orgstringObrigatório

The organization name. The name is not case sensitive.

team_slugstringObrigatório

The slug of the team name.

Body parameters
Nome, Tipo, Descrição
groupsarray 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_idstringObrigatório

ID of the IdP group.

group_namestringObrigatório

Name of the IdP group.

group_descriptionstringObrigatório

Description of the IdP group.

HTTP response status codes

Status codeDescrição
200

OK

Amostras de código

patch/orgs/{org}/teams/{team_slug}/team-sync/group-mappings
curl \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: token <TOKEN>" \ 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.

Parâmetros

Headers
Nome, Tipo, Descrição
acceptstring

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

Path parameters
Nome, Tipo, Descrição
team_idintegerObrigatório

The unique identifier of the team.

HTTP response status codes

Status codeDescrição
200

OK

403

Forbidden

404

Resource not found

Amostras de código

get/teams/{team_id}/team-sync/group-mappings
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: token <TOKEN>" \ 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

Headers
Nome, Tipo, Descrição
acceptstring

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

Path parameters
Nome, Tipo, Descrição
team_idintegerObrigatório

The unique identifier of the team.

Body parameters
Nome, Tipo, Descrição
groupsarray of objectsObrigató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_idstringObrigatório

ID of the IdP group.

group_namestringObrigatório

Name of the IdP group.

group_descriptionstringObrigatório

Description of the IdP group.

idstring
namestring
descriptionstring
synced_atstring

HTTP response status codes

Status codeDescrição
200

OK

403

Forbidden

422

Validation failed

Amostras de código

patch/teams/{team_id}/team-sync/group-mappings
curl \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: token <TOKEN>" \ 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." } ] }