Pontos de extremidade da API REST para membros da equipe corporativa
Use a API REST para criar e gerenciar membros de equipes corporativas em sua empresa do GitHub.
Sobre os membros da equipe corporativa
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:.
List members in an enterprise team
Lists all team members in an enterprise team.
Tokens de acesso refinados para "List members in an enterprise team"
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 "List members in an enterprise team"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
enterprise string ObrigatórioThe slug version of the enterprise name. |
enterprise-team string ObrigatórioThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| 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: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List members in an enterprise team"
| Código de status | Descrição |
|---|---|
200 | OK |
Exemplos de código para "List members in an enterprise team"
Exemplo de solicitação
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/membershipsResponse
Status: 200[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Bulk add team members
Add multiple team members to an enterprise team.
Tokens de acesso refinados para "Bulk add team members"
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 "Bulk add team members"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
enterprise string ObrigatórioThe slug version of the enterprise name. |
enterprise-team string ObrigatórioThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nome, Tipo, Descrição |
|---|
usernames array of strings ObrigatórioThe GitHub user handles to add to the team. |
Códigos de status de resposta HTTP para "Bulk add team members"
| Código de status | Descrição |
|---|---|
200 | Successfully added team members. |
Exemplos de código para "Bulk add team members"
Exemplo de solicitação
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/memberships/add \
-d '{"usernames":["monalisa","octocat"]}'Successfully added team members.
Status: 200[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Bulk remove team members
Remove multiple team members from an enterprise team.
Tokens de acesso refinados para "Bulk remove team members"
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 "Bulk remove team members"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
enterprise string ObrigatórioThe slug version of the enterprise name. |
enterprise-team string ObrigatórioThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nome, Tipo, Descrição |
|---|
usernames array of strings ObrigatórioThe GitHub user handles to be removed from the team. |
Códigos de status de resposta HTTP para "Bulk remove team members"
| Código de status | Descrição |
|---|---|
200 | Successfully removed team members. |
Exemplos de código para "Bulk remove team members"
Exemplo de solicitação
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/memberships/remove \
-d '{"usernames":["monalisa","octocat"]}'Successfully removed team members.
Status: 200[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Get enterprise team membership
Returns whether the user is a member of the enterprise team.
Tokens de acesso refinados para "Get enterprise team membership"
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 enterprise team membership"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
enterprise string ObrigatórioThe slug version of the enterprise name. |
enterprise-team string ObrigatórioThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
username string ObrigatórioThe handle for the GitHub user account. |
Códigos de status de resposta HTTP para "Get enterprise team membership"
| Código de status | Descrição |
|---|---|
200 | User is a member of the enterprise team. |
Exemplos de código para "Get enterprise team membership"
Exemplo de solicitação
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/memberships/USERNAMEUser is a member of the enterprise team.
Status: 200{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}Add team member
Add a team member to an enterprise team.
Tokens de acesso refinados para "Add team member"
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 team member"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
enterprise string ObrigatórioThe slug version of the enterprise name. |
enterprise-team string ObrigatórioThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
username string ObrigatórioThe handle for the GitHub user account. |
Códigos de status de resposta HTTP para "Add team member"
| Código de status | Descrição |
|---|---|
201 | Successfully added team member |
Exemplos de código para "Add team member"
Exemplo de solicitação
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/memberships/USERNAMESuccessfully added team member
Status: 201{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}Remove team membership
Remove membership of a specific user from a particular team in an enterprise.
Tokens de acesso refinados para "Remove team membership"
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 team membership"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
enterprise string ObrigatórioThe slug version of the enterprise name. |
enterprise-team string ObrigatórioThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
username string ObrigatórioThe handle for the GitHub user account. |
Códigos de status de resposta HTTP para "Remove team membership"
| Código de status | Descrição |
|---|---|
204 | No Content |
403 | Forbidden |
Exemplos de código para "Remove team membership"
Exemplo de solicitação
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/memberships/USERNAMEResponse
Status: 204