Skip to main content
REST API теперь версия. Дополнительные сведения см. в разделе "О управлении версиями API".

Конечные точки REST API для корпоративных команд

Используйте REST API для создания корпоративных команд и управления ими в организации GitHub предприятия.

О корпоративных командах

Примечание.

В настоящее время эти конечные точки находятся в 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: префикс.

List enterprise teams

List all teams in the enterprise for the authenticated user

Подробные маркеры доступа для "List enterprise teams

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

Параметры для "List enterprise teams"

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

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

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

The slug version of the enterprise name.

Параметры запроса
Имя., Тип, 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-ответа для "List enterprise teams"

Код состоянияDescription
200

OK

403

Forbidden

Примеры кода для "List enterprise teams"

Если вы обращаетесь к GitHub в GHE.com, заменитеapi.github.com выделенный поддоменapi.SUBDOMAIN.ghe.comпредприятия.

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

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

Response

Status: 200
[ { "id": 1, "name": "Justice League", "description": "A great team.", "slug": "justice-league", "url": "https://api.github.com/enterprises/dc/teams/justice-league", "group_id": "62ab9291-fae2-468e-974b-7e45096d5021", "html_url": "https://github.com/enterprises/dc/teams/justice-league", "members_url": "https://api.github.com/enterprises/dc/teams/justice-league/members{/member}", "created_at": "2019-01-26T19:01:12Z", "updated_at": "2019-01-26T19:14:43Z" } ]

Create an enterprise team

To create an enterprise team, the authenticated user must be an owner of the enterprise.

Подробные маркеры доступа для "Create an enterprise team

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

Параметры для "Create an enterprise team"

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

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

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

The slug version of the enterprise name.

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

The name of the team.

description string or null

A description of the team.

sync_to_organizations string

Retired: this field is no longer supported. Whether the enterprise team should be reflected in each organization. This value cannot be set.

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

Возможные значения: all, disabled

organization_selection_type string

Specifies which organizations in the enterprise should have access to this team. Can be one of disabled, selected, or all. disabled: The team is not assigned to any organizations. This is the default when you create a new team. selected: The team is assigned to specific organizations. You can then use the add organization assignments API endpoint. all: The team is assigned to all current and future organizations in the enterprise.

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

Возможные значения: disabled, selected, all

group_id string or null

The ID of the IdP group to assign team membership with. You can get this value from the REST API endpoints for SCIM.

Коды состояния http-ответа для "Create an enterprise team"

Код состоянияDescription
201

Created

Примеры кода для "Create an enterprise team"

Если вы обращаетесь к GitHub в GHE.com, заменитеapi.github.com выделенный поддоменapi.SUBDOMAIN.ghe.comпредприятия.

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

post/enterprises/{enterprise}/teams
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 \ -d '{"name":"Justice League","description":"A great team.","group_id":"62ab9291-fae2-468e-974b-7e45096d5021"}'

Response

Status: 201
[ { "id": 1, "name": "Justice League", "description": "A great team.", "slug": "justice-league", "url": "https://api.github.com/enterprises/dc/teams/justice-league", "group_id": "62ab9291-fae2-468e-974b-7e45096d5021", "html_url": "https://github.com/enterprises/dc/teams/justice-league", "members_url": "https://api.github.com/enterprises/dc/teams/justice-league/members{/member}", "created_at": "2019-01-26T19:01:12Z", "updated_at": "2019-01-26T19:14:43Z" } ]

Get an enterprise team

Gets a team using the team's slug. To create the slug, GitHub replaces special characters in the name string, changes all words to lowercase, and replaces spaces with a - separator and adds the "ent:" prefix. For example, "My TEam Näme" would become ent:my-team-name.

Подробные маркеры доступа для "Get an enterprise team

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

Параметры для "Get an enterprise team"

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

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

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

The slug version of the enterprise name.

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

The slug of the team name.

Коды состояния http-ответа для "Get an enterprise team"

Код состоянияDescription
200

OK

403

Forbidden

Примеры кода для "Get an enterprise team"

Если вы обращаетесь к GitHub в GHE.com, заменитеapi.github.com выделенный поддоменapi.SUBDOMAIN.ghe.comпредприятия.

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

get/enterprises/{enterprise}/teams/{team_slug}
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/TEAM_SLUG

Response

Status: 200
[ { "id": 1, "name": "Justice League", "description": "A great team.", "slug": "justice-league", "url": "https://api.github.com/enterprises/dc/teams/justice-league", "group_id": "62ab9291-fae2-468e-974b-7e45096d5021", "html_url": "https://github.com/enterprises/dc/teams/justice-league", "members_url": "https://api.github.com/enterprises/dc/teams/justice-league/members{/member}", "created_at": "2019-01-26T19:01:12Z", "updated_at": "2019-01-26T19:14:43Z" } ]

Update an enterprise team

To edit a team, the authenticated user must be an enterprise owner.

Подробные маркеры доступа для "Update an enterprise team

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

Параметры для "Update an enterprise team"

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

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

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

The slug version of the enterprise name.

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

The slug of the team name.

Параметры запроса
Имя., Тип, Description
name string or null

A new name for the team.

description string or null

A new description for the team.

sync_to_organizations string

Retired: this field is no longer supported. Whether the enterprise team should be reflected in each organization. This value cannot be changed.

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

Возможные значения: all, disabled

organization_selection_type string

Specifies which organizations in the enterprise should have access to this team. Can be one of disabled, selected, or all. disabled: The team is not assigned to any organizations. This is the default when you create a new team. selected: The team is assigned to specific organizations. You can then use the add organization assignments API. all: The team is assigned to all current and future organizations in the enterprise.

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

Возможные значения: disabled, selected, all

group_id string or null

The ID of the IdP group to assign team membership with. The new IdP group will replace the existing one, or replace existing direct members if the team isn't currently linked to an IdP group.

Коды состояния http-ответа для "Update an enterprise team"

Код состоянияDescription
200

OK

403

Forbidden

Примеры кода для "Update an enterprise team"

Если вы обращаетесь к GitHub в GHE.com, заменитеapi.github.com выделенный поддоменapi.SUBDOMAIN.ghe.comпредприятия.

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

patch/enterprises/{enterprise}/teams/{team_slug}
curl -L \ -X PATCH \ -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/TEAM_SLUG \ -d '{"name":"Justice League","description":"A great team.","group_id":"62ab9291-fae2-468e-974b-7e45096d5021"}'

Response

Status: 200
[ { "id": 1, "name": "Justice League", "description": "A great team.", "slug": "justice-league", "url": "https://api.github.com/enterprises/dc/teams/justice-league", "group_id": "62ab9291-fae2-468e-974b-7e45096d5021", "html_url": "https://github.com/enterprises/dc/teams/justice-league", "members_url": "https://api.github.com/enterprises/dc/teams/justice-league/members{/member}", "created_at": "2019-01-26T19:01:12Z", "updated_at": "2019-01-26T19:14:43Z" } ]

Delete an enterprise team

To delete an enterprise team, the authenticated user must be an enterprise owner.

If you are an enterprise owner, deleting an enterprise team will delete all of its IdP mappings as well.

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

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

Параметры для "Delete an enterprise team"

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

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

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

The slug version of the enterprise name.

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

The slug of the team name.

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

Код состоянияDescription
204

No Content

403

Forbidden

Примеры кода для "Delete an enterprise team"

Если вы обращаетесь к GitHub в GHE.com, заменитеapi.github.com выделенный поддоменapi.SUBDOMAIN.ghe.comпредприятия.

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

delete/enterprises/{enterprise}/teams/{team_slug}
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/TEAM_SLUG

Response

Status: 204