REST-API-Endpunkte für Unternehmensteammitgliedschaften
Verwende die REST-API, um die Mitgliedschaft von Unternehmensteams in deinem GitHub-Unternehmen zu erstellen und zu verwalten.
Info zu Unternehmensteammitgliedern
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.
List members in an enterprise team
Lists all team members in an enterprise team.
Differenzierte Zugriffstoken für "List members in an enterprise team"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „List members in an enterprise team“
| 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 „List members in an enterprise team“
| Statuscode | BESCHREIBUNG |
|---|---|
200 | OK |
Codebeispiele für „List members in an enterprise team“
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/membershipsResponse
Status: 200[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Bulk add team members
Add multiple team members to an enterprise team.
Differenzierte Zugriffstoken für "Bulk add team members"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Bulk add team members“
| 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 |
|---|
usernames array of strings ErforderlichThe GitHub user handles to add to the team. |
HTTP-Antwortstatuscodes für „Bulk add team members“
| Statuscode | BESCHREIBUNG |
|---|---|
200 | Successfully added team members. |
Codebeispiele für „Bulk add team members“
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/memberships/add \
-d '{"usernames":["monalisa","octocat"]}'Successfully added team members.
Status: 200[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Bulk remove team members
Remove multiple team members from an enterprise team.
Differenzierte Zugriffstoken für "Bulk remove team members"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Bulk remove team members“
| 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 |
|---|
usernames array of strings ErforderlichThe GitHub user handles to be removed from the team. |
HTTP-Antwortstatuscodes für „Bulk remove team members“
| Statuscode | BESCHREIBUNG |
|---|---|
200 | Successfully removed team members. |
Codebeispiele für „Bulk remove team members“
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/memberships/remove \
-d '{"usernames":["monalisa","octocat"]}'Successfully removed team members.
Status: 200[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Get enterprise team membership
Returns whether the user is a member of the enterprise team.
Differenzierte Zugriffstoken für "Get enterprise team membership"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Get enterprise team membership“
| 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. |
username string ErforderlichThe handle for the GitHub user account. |
HTTP-Antwortstatuscodes für „Get enterprise team membership“
| Statuscode | BESCHREIBUNG |
|---|---|
200 | User is a member of the enterprise team. |
Codebeispiele für „Get enterprise team membership“
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/memberships/USERNAMEUser is a member of the enterprise team.
Status: 200{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}Add team member
Add a team member to an enterprise team.
Differenzierte Zugriffstoken für "Add team member"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Add team member“
| 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. |
username string ErforderlichThe handle for the GitHub user account. |
HTTP-Antwortstatuscodes für „Add team member“
| Statuscode | BESCHREIBUNG |
|---|---|
201 | Successfully added team member |
Codebeispiele für „Add team member“
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/memberships/USERNAMESuccessfully added team member
Status: 201{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}Remove team membership
Remove membership of a specific user from a particular team in an enterprise.
Differenzierte Zugriffstoken für "Remove team membership"
Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.
Parameter für „Remove team membership“
| 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. |
username string ErforderlichThe handle for the GitHub user account. |
HTTP-Antwortstatuscodes für „Remove team membership“
| Statuscode | BESCHREIBUNG |
|---|---|
204 | No Content |
403 | Forbidden |
Codebeispiele für „Remove team membership“
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/memberships/USERNAMEResponse
Status: 204