Points de terminaison de l’API REST pour les appartenances aux équipes d’entreprise
Utilisez l’API REST pour créer et gérer l’appartenance aux équipes d’entreprise dans votre GitHub entreprise.
À propos des membres des équipes d’entreprise
Remarque
Ces points de terminaison se trouvent actuellement en préversion publique et peuvent être amenés à changer.
Cette documentation API est destinée aux entreprises sur GitHub Enterprise Cloud.
Si votre entreprise utilise Copilot Business pour un environnement non-GHE, veuillez vous référer au lien de documentation en accès anticipé qui vous a été communiqué précédemment.
Ces points de terminaison ne sont disponibles que pour les membres authentifiés de l’entreprise de l’équipe d’entreprise, disposant de personal access tokens classiques avec l’étendue read:enterprise pour les API GET et admin:enterprise pour les autres API.
Ces points de terminaison ne sont pas compatibles avec fine-grained personal access tokens ni avec les jetons d’accès GitHub App.
GitHub génère le slug de l’équipe d’entreprise à partir de l’équipe name et ajoute le préfixe ent:.
List members in an enterprise team
Lists all team members in an enterprise team.
Jetons d'accès granulaires pour «List members in an enterprise team»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Enterprise teams" enterprise permissions (read)
Paramètres pour «List members in an enterprise team »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string RequisThe slug version of the enterprise name. |
enterprise-team string RequisThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nom, Type, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Par défaut: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Par défaut: |
Codes d’état de réponse HTTP pour «List members in an enterprise team »
| Code de statut | Description |
|---|---|
200 | OK |
Exemples de code pour «List members in an enterprise team »
Exemple de requête
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/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://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Bulk add team members
Add multiple team members to an enterprise team.
Jetons d'accès granulaires pour «Bulk add team members»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Enterprise teams" enterprise permissions (write)
Paramètres pour «Bulk add team members »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string RequisThe slug version of the enterprise name. |
enterprise-team string RequisThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nom, Type, Description |
|---|
usernames array of strings RequisThe GitHub user handles to add to the team. |
Codes d’état de réponse HTTP pour «Bulk add team members »
| Code de statut | Description |
|---|---|
200 | Successfully added team members. |
Exemples de code pour «Bulk add team members »
Exemple de requête
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/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://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Bulk remove team members
Remove multiple team members from an enterprise team.
Jetons d'accès granulaires pour «Bulk remove team members»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Enterprise teams" enterprise permissions (write)
Paramètres pour «Bulk remove team members »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string RequisThe slug version of the enterprise name. |
enterprise-team string RequisThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nom, Type, Description |
|---|
usernames array of strings RequisThe GitHub user handles to be removed from the team. |
Codes d’état de réponse HTTP pour «Bulk remove team members »
| Code de statut | Description |
|---|---|
200 | Successfully removed team members. |
Exemples de code pour «Bulk remove team members »
Exemple de requête
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/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://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]Add team member
Add a team member to an enterprise team.
Jetons d'accès granulaires pour «Add team member»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Enterprise teams" enterprise permissions (write)
Paramètres pour «Add team member »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string RequisThe slug version of the enterprise name. |
enterprise-team string RequisThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
username string RequisThe handle for the GitHub user account. |
Codes d’état de réponse HTTP pour «Add team member »
| Code de statut | Description |
|---|---|
201 | Successfully added team member |
Exemples de code pour «Add team member »
Exemple de requête
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/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://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/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.
Jetons d'accès granulaires pour «Remove team membership»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Enterprise teams" enterprise permissions (write)
Paramètres pour «Remove team membership »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string RequisThe slug version of the enterprise name. |
enterprise-team string RequisThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
username string RequisThe handle for the GitHub user account. |
Codes d’état de réponse HTTP pour «Remove team membership »
| Code de statut | Description |
|---|---|
204 | No Content |
403 | Forbidden |
Exemples de code pour «Remove team membership »
Exemple de requête
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/memberships/USERNAMEResponse
Status: 204