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".

REST API endpoints for enterprise team organizations

Use the REST API to create and manage organization assignments for enterprise teams in your GitHub enterprise.

About enterprise team organizations

Observação

Esses pontos de extremidade estão em versão prévia pública e estão sujeitos a alterações.

Esta documentação de API é para empresas no GitHub Enterprise Cloud.

Se sua empresa for do Copilot Business para não GHE, consulte o link da documentação de acesso antecipado que foi compartilhado com você.

Esses pontos de extremidade só estão disponíveis para membros autenticados da equipe corporativa com o personal access tokens clássico com o escopo read:enterprise para APIs do GET e admin:enterprise para outras APIs.

Esses pontos de extremidade não são compatíveis com fine-grained personal access tokens ou tokens de acesso do Aplicativo GitHub.

O GitHub gera o slug da equipe corporativa com base no name da equipe e adiciona o prefixo ent:.

Get organization assignments

Get all organizations assigned to an enterprise team

Tokens de acesso refinados para "Get organization assignments"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do aplicativo GitHub, tokens de acesso de instalação do aplicativo GitHub ou tokens de acesso pessoal refinados.

Parâmetros para "Get organization assignments"

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

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

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

The slug version of the enterprise name.

enterprise-team string Obrigatório

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

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 integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Padrão: 1

Códigos de status de resposta HTTP para "Get organization assignments"

Código de statusDescrição
200

An array of organizations the team is assigned to

Exemplos de código para "Get organization assignments"

Exemplo de solicitação

get/enterprises/{enterprise}/teams/{enterprise-team}/organizations
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/organizations

An array of organizations the team is assigned to

Status: 200
{ "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "hooks_url": "https://api.github.com/orgs/github/hooks", "issues_url": "https://api.github.com/orgs/github/issues", "members_url": "https://api.github.com/orgs/github/members{/member}", "public_members_url": "https://api.github.com/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" }

Add organization assignments

Assign an enterprise team to multiple organizations.

Tokens de acesso refinados para "Add organization assignments"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do aplicativo GitHub, tokens de acesso de instalação do aplicativo GitHub ou tokens de acesso pessoal refinados.

Parâmetros para "Add organization assignments"

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

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

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

The slug version of the enterprise name.

enterprise-team string Obrigatório

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

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

Organization slug to assign the team to.

Códigos de status de resposta HTTP para "Add organization assignments"

Código de statusDescrição
200

Successfully assigned the enterprise team to organizations.

Exemplos de código para "Add organization assignments"

Exemplo de solicitação

post/enterprises/{enterprise}/teams/{enterprise-team}/organizations/add
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/organizations/add \ -d '{"organization_slugs":["github"]}'

Successfully assigned the enterprise team to organizations.

Status: 200
[ { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "hooks_url": "https://api.github.com/orgs/github/hooks", "issues_url": "https://api.github.com/orgs/github/issues", "members_url": "https://api.github.com/orgs/github/members{/member}", "public_members_url": "https://api.github.com/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" } ]

Remove organization assignments

Unassign an enterprise team from multiple organizations.

Tokens de acesso refinados para "Remove organization assignments"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do aplicativo GitHub, tokens de acesso de instalação do aplicativo GitHub ou tokens de acesso pessoal refinados.

Parâmetros para "Remove organization assignments"

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

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

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

The slug version of the enterprise name.

enterprise-team string Obrigatório

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

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

Organization slug to unassign the team from.

Códigos de status de resposta HTTP para "Remove organization assignments"

Código de statusDescrição
204

Successfully unassigned the enterprise team from organizations.

Exemplos de código para "Remove organization assignments"

Exemplo de solicitação

post/enterprises/{enterprise}/teams/{enterprise-team}/organizations/remove
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/organizations/remove \ -d '{"organization_slugs":["github"]}'

Successfully unassigned the enterprise team from organizations.

Status: 204

Get organization assignment

Check if an enterprise team is assigned to an organization

Tokens de acesso refinados para "Get organization assignment"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do aplicativo GitHub, tokens de acesso de instalação do aplicativo GitHub ou tokens de acesso pessoal refinados.

Parâmetros para "Get organization assignment"

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

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

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

The slug version of the enterprise name.

enterprise-team string Obrigatório

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get organization assignment"

Código de statusDescrição
200

The team is assigned to the organization

404

The team is not assigned to the organization

Exemplos de código para "Get organization assignment"

Exemplo de solicitação

get/enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org}
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/organizations/ORG

The team is assigned to the organization

Status: 200
{ "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "hooks_url": "https://api.github.com/orgs/github/hooks", "issues_url": "https://api.github.com/orgs/github/issues", "members_url": "https://api.github.com/orgs/github/members{/member}", "public_members_url": "https://api.github.com/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" }

Add an organization assignment

Assign an enterprise team to an organization.

Tokens de acesso refinados para "Add an organization assignment"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do aplicativo GitHub, tokens de acesso de instalação do aplicativo GitHub ou tokens de acesso pessoal refinados.

Parâmetros para "Add an organization assignment"

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

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

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

The slug version of the enterprise name.

enterprise-team string Obrigatório

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Add an organization assignment"

Código de statusDescrição
201

Successfully assigned the enterprise team to the organization.

Exemplos de código para "Add an organization assignment"

Exemplo de solicitação

put/enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org}
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/organizations/ORG

Successfully assigned the enterprise team to the organization.

Status: 201
{ "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "hooks_url": "https://api.github.com/orgs/github/hooks", "issues_url": "https://api.github.com/orgs/github/issues", "members_url": "https://api.github.com/orgs/github/members{/member}", "public_members_url": "https://api.github.com/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" }

Delete an organization assignment

Unassign an enterprise team from an organization.

Tokens de acesso refinados para "Delete an organization assignment"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do aplicativo GitHub, tokens de acesso de instalação do aplicativo GitHub ou tokens de acesso pessoal refinados.

Parâmetros para "Delete an organization assignment"

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

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

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

The slug version of the enterprise name.

enterprise-team string Obrigatório

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Delete an organization assignment"

Código de statusDescrição
204

Successfully unassigned the enterprise team from the organization.

Exemplos de código para "Delete an organization assignment"

Exemplo de solicitação

delete/enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org}
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/organizations/ORG

Successfully unassigned the enterprise team from the organization.

Status: 204