Puntos de conexión de la API de REST para pertenencias a equipos empresariales
Usa la API de REST para crear y administrar la pertenencia de equipos empresariales en tu empresa de GitHub.
Acerca de los miembros del equipo empresarial
Nota:
Actualmente, estos puntos de conexión se encuentran en versión preliminar pública y están sujetos a cambios.
Esta documentación de la API está destinada a empresas en GitHub Enterprise Cloud.
Si tu empresa es Copilot Business para no GHE, consulta el vínculo de documentación de acceso anticipado que se te ha compartido anteriormente.
Estos puntos de conexión solo están disponibles para los miembros autenticados de la empresa del equipo empresarial con personal access tokens clásicos con el ámbito read:enterprise de las API GET y admin:enterprise para otras API.
Estos puntos de conexión no son compatibles con fine-grained personal access tokens o tokens de acceso a aplicaciones de GitHub.
GitHub genera el slug del equipo empresarial a partir del equipo name y agrega el prefijo ent:.
List members in an enterprise team
Lists all team members in an enterprise team.
Tokens de acceso específicos para "List members in an enterprise team"
Este punto de conexión no funciona con tokens de acceso de usuario de aplicación de GitHub, tokens de acceso de instalación de aplicaciones de GitHub ni tokens de acceso personales específicos.
Parámetros para "List members in an enterprise team"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
enterprise string RequeridoThe slug version of the enterprise name. |
enterprise-team string RequeridoThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nombre, Tipo, Descripción |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Valor predeterminado: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Valor predeterminado: |
Códigos de estado de respuesta HTTP para "List members in an enterprise team"
| status code | Descripción |
|---|---|
200 | OK |
Ejemplos de código para "List members in an enterprise team"
Si accedes a GitHub en GHE.com, reemplaza api.github.com por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com.
Ejemplo de solicitud
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 acceso específicos para "Bulk add team members"
Este punto de conexión no funciona con tokens de acceso de usuario de aplicación de GitHub, tokens de acceso de instalación de aplicaciones de GitHub ni tokens de acceso personales específicos.
Parámetros para "Bulk add team members"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
enterprise string RequeridoThe slug version of the enterprise name. |
enterprise-team string RequeridoThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nombre, Tipo, Descripción |
|---|
usernames array of strings RequeridoThe GitHub user handles to add to the team. |
Códigos de estado de respuesta HTTP para "Bulk add team members"
| status code | Descripción |
|---|---|
200 | Successfully added team members. |
Ejemplos de código para "Bulk add team members"
Si accedes a GitHub en GHE.com, reemplaza api.github.com por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com.
Ejemplo de solicitud
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 acceso específicos para "Bulk remove team members"
Este punto de conexión no funciona con tokens de acceso de usuario de aplicación de GitHub, tokens de acceso de instalación de aplicaciones de GitHub ni tokens de acceso personales específicos.
Parámetros para "Bulk remove team members"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
enterprise string RequeridoThe slug version of the enterprise name. |
enterprise-team string RequeridoThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nombre, Tipo, Descripción |
|---|
usernames array of strings RequeridoThe GitHub user handles to be removed from the team. |
Códigos de estado de respuesta HTTP para "Bulk remove team members"
| status code | Descripción |
|---|---|
200 | Successfully removed team members. |
Ejemplos de código para "Bulk remove team members"
Si accedes a GitHub en GHE.com, reemplaza api.github.com por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com.
Ejemplo de solicitud
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 acceso específicos para "Get enterprise team membership"
Este punto de conexión no funciona con tokens de acceso de usuario de aplicación de GitHub, tokens de acceso de instalación de aplicaciones de GitHub ni tokens de acceso personales específicos.
Parámetros para "Get enterprise team membership"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
enterprise string RequeridoThe slug version of the enterprise name. |
enterprise-team string RequeridoThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
username string RequeridoThe handle for the GitHub user account. |
Códigos de estado de respuesta HTTP para "Get enterprise team membership"
| status code | Descripción |
|---|---|
200 | User is a member of the enterprise team. |
Ejemplos de código para "Get enterprise team membership"
Si accedes a GitHub en GHE.com, reemplaza api.github.com por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com.
Ejemplo de solicitud
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 acceso específicos para "Add team member"
Este punto de conexión no funciona con tokens de acceso de usuario de aplicación de GitHub, tokens de acceso de instalación de aplicaciones de GitHub ni tokens de acceso personales específicos.
Parámetros para "Add team member"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
enterprise string RequeridoThe slug version of the enterprise name. |
enterprise-team string RequeridoThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
username string RequeridoThe handle for the GitHub user account. |
Códigos de estado de respuesta HTTP para "Add team member"
| status code | Descripción |
|---|---|
201 | Successfully added team member |
Ejemplos de código para "Add team member"
Si accedes a GitHub en GHE.com, reemplaza api.github.com por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com.
Ejemplo de solicitud
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 acceso específicos para "Remove team membership"
Este punto de conexión no funciona con tokens de acceso de usuario de aplicación de GitHub, tokens de acceso de instalación de aplicaciones de GitHub ni tokens de acceso personales específicos.
Parámetros para "Remove team membership"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
enterprise string RequeridoThe slug version of the enterprise name. |
enterprise-team string RequeridoThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
username string RequeridoThe handle for the GitHub user account. |
Códigos de estado de respuesta HTTP para "Remove team membership"
| status code | Descripción |
|---|---|
204 | No Content |
403 | Forbidden |
Ejemplos de código para "Remove team membership"
Si accedes a GitHub en GHE.com, reemplaza api.github.com por el subdominio dedicado de la empresa en api.SUBDOMAIN.ghe.com.
Ejemplo de solicitud
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