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
Hinweis
Diese Endpunkte befinden sich derzeit in public preview. Änderungen sind vorbehalten.
Diese API-Dokumentation ist für Unternehmen mit GitHub Enterprise Cloud bestimmt.
Wenn dein Unternehmen Copilot Business für Nicht-GHE nutzt, lies den Link zur Early-Access-Dokumentation, der zuvor geteilt wurde.
Diese Endpunkte sind lediglich für authentifizierte Mitglieder des Unternehmens im Unternehmensteams mit klassischen personal access tokens mit dem read:enterprise-Bereich für GET-APIs und admin:enterprise für weitere APIs verfügbar.
Diese Endpunkte sind nicht mit fine-grained personal access tokens oder GitHub-App-Zugriffstoken kompatibel.
GitHub generiert das slug-Element des Unternehmensteams aus dem Team name und fügt das Präfix ent: hinzu.
Get organization assignments
Get all organizations assigned to an enterprise team
Differenzierte Zugriffstoken für "Get organization assignments"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Get organization assignments“
| Name, type, BESCHREIBUNG |
|---|
accept string Setting to |
| Name, type, BESCHREIBUNG |
|---|
enterprise string ErforderlichThe slug version of the enterprise name. |
enterprise-team string ErforderlichThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Name, type, BESCHREIBUNG |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „Get organization assignments“
| Statuscode | BESCHREIBUNG |
|---|---|
200 | An array of organizations the team is assigned to |
Codebeispiele für „Get organization assignments“
Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.
Anforderungsbeispiel
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/organizationsAn 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.
Differenzierte Zugriffstoken für "Add organization assignments"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Add organization assignments“
| Name, type, BESCHREIBUNG |
|---|
accept string Setting to |
| Name, type, BESCHREIBUNG |
|---|
enterprise string ErforderlichThe slug version of the enterprise name. |
enterprise-team string ErforderlichThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Name, type, BESCHREIBUNG |
|---|
organization_slugs array of strings ErforderlichOrganization slug to assign the team to. |
HTTP-Antwortstatuscodes für „Add organization assignments“
| Statuscode | BESCHREIBUNG |
|---|---|
200 | Successfully assigned the enterprise team to organizations. |
Codebeispiele für „Add organization assignments“
Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.
Anforderungsbeispiel
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.
Differenzierte Zugriffstoken für "Remove organization assignments"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Remove organization assignments“
| Name, type, BESCHREIBUNG |
|---|
accept string Setting to |
| Name, type, BESCHREIBUNG |
|---|
enterprise string ErforderlichThe slug version of the enterprise name. |
enterprise-team string ErforderlichThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Name, type, BESCHREIBUNG |
|---|
organization_slugs array of strings ErforderlichOrganization slug to unassign the team from. |
HTTP-Antwortstatuscodes für „Remove organization assignments“
| Statuscode | BESCHREIBUNG |
|---|---|
204 | Successfully unassigned the enterprise team from organizations. |
Codebeispiele für „Remove organization assignments“
Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.
Anforderungsbeispiel
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: 204Get organization assignment
Check if an enterprise team is assigned to an organization
Differenzierte Zugriffstoken für "Get organization assignment"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Get organization assignment“
| Name, type, BESCHREIBUNG |
|---|
accept string Setting to |
| Name, type, BESCHREIBUNG |
|---|
enterprise string ErforderlichThe slug version of the enterprise name. |
enterprise-team string ErforderlichThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
org string ErforderlichThe organization name. The name is not case sensitive. |
HTTP-Antwortstatuscodes für „Get organization assignment“
| Statuscode | BESCHREIBUNG |
|---|---|
200 | The team is assigned to the organization |
404 | The team is not assigned to the organization |
Codebeispiele für „Get organization assignment“
Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.
Anforderungsbeispiel
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/ORGThe 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.
Differenzierte Zugriffstoken für "Add an organization assignment"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Add an organization assignment“
| Name, type, BESCHREIBUNG |
|---|
accept string Setting to |
| Name, type, BESCHREIBUNG |
|---|
enterprise string ErforderlichThe slug version of the enterprise name. |
enterprise-team string ErforderlichThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
org string ErforderlichThe organization name. The name is not case sensitive. |
HTTP-Antwortstatuscodes für „Add an organization assignment“
| Statuscode | BESCHREIBUNG |
|---|---|
201 | Successfully assigned the enterprise team to the organization. |
Codebeispiele für „Add an organization assignment“
Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.
Anforderungsbeispiel
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/ORGSuccessfully 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.
Differenzierte Zugriffstoken für "Delete an organization assignment"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Delete an organization assignment“
| Name, type, BESCHREIBUNG |
|---|
accept string Setting to |
| Name, type, BESCHREIBUNG |
|---|
enterprise string ErforderlichThe slug version of the enterprise name. |
enterprise-team string ErforderlichThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
org string ErforderlichThe organization name. The name is not case sensitive. |
HTTP-Antwortstatuscodes für „Delete an organization assignment“
| Statuscode | BESCHREIBUNG |
|---|---|
204 | Successfully unassigned the enterprise team from the organization. |
Codebeispiele für „Delete an organization assignment“
Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.
Anforderungsbeispiel
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/ORGSuccessfully unassigned the enterprise team from the organization.
Status: 204