Skip to main content
REST API теперь версия. Дополнительные сведения см. в разделе "О управлении версиями 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

Примечание.

В настоящее время эти конечные точки находятся в public preview и подвергаются изменению.

Эта документация по API предназначена для предприятий на GitHub Enterprise Cloud.

Если ваше предприятие — Copilot Business for non-GHE, обратитесь к ссылке документации по началу доступа, которая ранее была предоставлена вам.

Эти конечные точки доступны только для прошедших проверку подлинности членов предприятия команды предприятия с классической версией personal access tokens с read:enterprise областью GET действия API и admin:enterprise для других API.

Эти конечные точки несовместимы с маркерами доступа к приложениям fine-grained personal access tokens или GitHub App.

GitHub создает команду предприятия slug из команды name и добавляет ent: префикс.

Get organization assignments

Get all organizations assigned to an enterprise team

Подробные маркеры доступа для "Get organization assignments

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "Get organization assignments"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name.

enterprise-team string Обязательное поле

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

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

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

По умолчанию.: 1

Коды состояния http-ответа для "Get organization assignments"

Код состоянияОписание
200

An array of organizations the team is assigned to

Примеры кода для "Get organization assignments"

Пример запроса

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.

Подробные маркеры доступа для "Add organization assignments

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "Add organization assignments"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name.

enterprise-team string Обязательное поле

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

Параметры запроса
Имя., Тип, Description
organization_slugs array of strings Обязательное поле

Organization slug to assign the team to.

Коды состояния http-ответа для "Add organization assignments"

Код состоянияОписание
200

Successfully assigned the enterprise team to organizations.

Примеры кода для "Add organization assignments"

Пример запроса

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.

Подробные маркеры доступа для "Remove organization assignments

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "Remove organization assignments"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name.

enterprise-team string Обязательное поле

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

Параметры запроса
Имя., Тип, Description
organization_slugs array of strings Обязательное поле

Organization slug to unassign the team from.

Коды состояния http-ответа для "Remove organization assignments"

Код состоянияОписание
204

Successfully unassigned the enterprise team from organizations.

Примеры кода для "Remove organization assignments"

Пример запроса

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

Подробные маркеры доступа для "Get organization assignment

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "Get organization assignment"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name.

enterprise-team string Обязательное поле

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

org string Обязательное поле

The organization name. The name is not case sensitive.

Коды состояния http-ответа для "Get organization assignment"

Код состоянияОписание
200

The team is assigned to the organization

404

The team is not assigned to the organization

Примеры кода для "Get organization assignment"

Пример запроса

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.

Подробные маркеры доступа для "Add an organization assignment

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "Add an organization assignment"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name.

enterprise-team string Обязательное поле

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

org string Обязательное поле

The organization name. The name is not case sensitive.

Коды состояния http-ответа для "Add an organization assignment"

Код состоянияОписание
201

Successfully assigned the enterprise team to the organization.

Примеры кода для "Add an organization assignment"

Пример запроса

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.

Подробные маркеры доступа для "Delete an organization assignment

Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.

Параметры для "Delete an organization assignment"

Заголовки
Имя., Тип, Description
accept string

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

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name.

enterprise-team string Обязательное поле

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

org string Обязательное поле

The organization name. The name is not case sensitive.

Коды состояния http-ответа для "Delete an organization assignment"

Код состоянияОписание
204

Successfully unassigned the enterprise team from the organization.

Примеры кода для "Delete an organization assignment"

Пример запроса

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