Skip to main content
Ahora la API de REST tiene control de versiones. Para obtener más información, consulta "Acerca del control de versiones de la 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

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

Get organization assignments

Get all organizations assigned to an enterprise team

Tokens de acceso específicos para "Get organization assignments"

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 organization assignments"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
enterprise string Requerido

The slug version of the enterprise name.

enterprise-team string Requerido

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

Parámetros de consulta
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: 30

page integer

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

Valor predeterminado: 1

Códigos de estado de respuesta HTTP para "Get organization assignments"

status codeDescripción
200

An array of organizations the team is assigned to

Ejemplos de código para "Get organization assignments"

Ejemplo de solicitud

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 acceso específicos para "Add organization assignments"

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 organization assignments"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
enterprise string Requerido

The slug version of the enterprise name.

enterprise-team string Requerido

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

Parámetros del cuerpo
Nombre, Tipo, Descripción
organization_slugs array of strings Requerido

Organization slug to assign the team to.

Códigos de estado de respuesta HTTP para "Add organization assignments"

status codeDescripción
200

Successfully assigned the enterprise team to organizations.

Ejemplos de código para "Add organization assignments"

Ejemplo de solicitud

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 acceso específicos para "Remove organization assignments"

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 organization assignments"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
enterprise string Requerido

The slug version of the enterprise name.

enterprise-team string Requerido

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

Parámetros del cuerpo
Nombre, Tipo, Descripción
organization_slugs array of strings Requerido

Organization slug to unassign the team from.

Códigos de estado de respuesta HTTP para "Remove organization assignments"

status codeDescripción
204

Successfully unassigned the enterprise team from organizations.

Ejemplos de código para "Remove organization assignments"

Ejemplo de solicitud

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 acceso específicos para "Get organization assignment"

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 organization assignment"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
enterprise string Requerido

The slug version of the enterprise name.

enterprise-team string Requerido

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

org string Requerido

The organization name. The name is not case sensitive.

Códigos de estado de respuesta HTTP para "Get organization assignment"

status codeDescripción
200

The team is assigned to the organization

404

The team is not assigned to the organization

Ejemplos de código para "Get organization assignment"

Ejemplo de solicitud

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 acceso específicos para "Add an organization assignment"

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 an organization assignment"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
enterprise string Requerido

The slug version of the enterprise name.

enterprise-team string Requerido

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

org string Requerido

The organization name. The name is not case sensitive.

Códigos de estado de respuesta HTTP para "Add an organization assignment"

status codeDescripción
201

Successfully assigned the enterprise team to the organization.

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

Ejemplo de solicitud

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 acceso específicos para "Delete an organization assignment"

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 "Delete an organization assignment"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
enterprise string Requerido

The slug version of the enterprise name.

enterprise-team string Requerido

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

org string Requerido

The organization name. The name is not case sensitive.

Códigos de estado de respuesta HTTP para "Delete an organization assignment"

status codeDescripción
204

Successfully unassigned the enterprise team from the organization.

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

Ejemplo de solicitud

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