Конечные точки 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 |
| Имя., Тип, 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." По умолчанию.: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." По умолчанию.: |
Коды состояния http-ответа для "List enterprise teams"
| Код состояния | Description |
|---|---|
200 | OK |
403 | Forbidden |
Примеры кода для "List enterprise teams"
Если вы обращаетесь к GitHub в GHE.com, заменитеapi.github.com выделенный поддоменapi.SUBDOMAIN.ghe.comпредприятия.
Пример запроса
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/teamsResponse
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 |
| Имя., Тип, 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. По умолчанию.: Возможные значения: |
organization_selection_type string Specifies which organizations in the enterprise should have access to this team. Can be one of По умолчанию.: Возможные значения: |
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предприятия.
Пример запроса
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 |
| Имя., Тип, 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предприятия.
Пример запроса
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_SLUGResponse
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 |
| Имя., Тип, 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. По умолчанию.: Возможные значения: |
organization_selection_type string Specifies which organizations in the enterprise should have access to this team. Can be one of По умолчанию.: Возможные значения: |
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предприятия.
Пример запроса
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 |
| Имя., Тип, 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предприятия.
Пример запроса
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_SLUGResponse
Status: 204