Cette version de GitHub Enterprise Server n'est plus disponible depuis le 2024-07-09. Aucune publication de correctifs n’est effectuée, même pour les problèmes de sécurité critiques. Pour de meilleures performances, une sécurité améliorée et de nouvelles fonctionnalités, effectuez une mise à niveau vers la dernière version de GitHub Enterprise. Pour obtenir de l’aide sur la mise à niveau, contactez le support GitHub Enterprise.
Points de terminaison d’API REST pour les abonnés
Utilisez l’API REST pour obtenir des informations sur les abonnés des utilisateurs authentifiés.
À propos de l’administration des abonnés
Si une URL de requête n’inclut pas de paramètre {username}, la réponse est destinée à l’utilisateur connecté (et vous devez transmettre des informations d’authentification avec votre demande). Des informations privées supplémentaires, par exemple si l’authentification à 2 facteurs a été activée par un utilisateur, sont incluses lors de l’authentification au moyen de l’authentification de base ou OAuth avec l’étendue user.
List followers of the authenticated user
Lists the people following the authenticated user.
Paramètres pour « List followers of the authenticated user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List followers of the authenticated user »
| Code d’état | Description |
|---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
Exemples de code pour « List followers of the authenticated user »
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/user/followersResponse
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
}
]List the people the authenticated user follows
Lists the people who the authenticated user follows.
Paramètres pour « List the people the authenticated user follows »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List the people the authenticated user follows »
| Code d’état | Description |
|---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
Exemples de code pour « List the people the authenticated user follows »
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/user/followingResponse
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
}
]Check if a person is followed by the authenticated user
Paramètres pour « Check if a person is followed by the authenticated user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string ObligatoireThe handle for the GitHub user account. |
Codes d’état de la réponse HTTP pour « Check if a person is followed by the authenticated user »
| Code d’état | Description |
|---|---|
204 | if the person is followed by the authenticated user |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | if the person is not followed by the authenticated user |
Exemples de code pour « Check if a person is followed by the authenticated user »
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/user/following/USERNAMEif the person is followed by the authenticated user
Status: 204Follow a user
Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
OAuth app tokens and personal access tokens (classic) need the user:follow scope to use this endpoint.
Paramètres pour « Follow a user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string ObligatoireThe handle for the GitHub user account. |
Codes d’état de la réponse HTTP pour « Follow a user »
| Code d’état | Description |
|---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour « Follow a user »
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/user/following/USERNAMEResponse
Status: 204Unfollow a user
OAuth app tokens and personal access tokens (classic) need the user:follow scope to use this endpoint.
Paramètres pour « Unfollow a user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string ObligatoireThe handle for the GitHub user account. |
Codes d’état de la réponse HTTP pour « Unfollow a user »
| Code d’état | Description |
|---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour « Unfollow a user »
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/user/following/USERNAMEResponse
Status: 204List followers of a user
Lists the people following the specified user.
Paramètres pour « List followers of a user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string ObligatoireThe handle for the GitHub user account. |
| Nom, Type, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List followers of a user »
| Code d’état | Description |
|---|---|
200 | OK |
Exemples de code pour « List followers of a user »
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/users/USERNAME/followersResponse
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
}
]List the people a user follows
Lists the people who the specified user follows.
Paramètres pour « List the people a user follows »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string ObligatoireThe handle for the GitHub user account. |
| Nom, Type, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List the people a user follows »
| Code d’état | Description |
|---|---|
200 | OK |
Exemples de code pour « List the people a user follows »
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/users/USERNAME/followingResponse
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
}
]Check if a user follows another user
Paramètres pour « Check if a user follows another user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string ObligatoireThe handle for the GitHub user account. |
target_user string Obligatoire |
Codes d’état de la réponse HTTP pour « Check if a user follows another user »
| Code d’état | Description |
|---|---|
204 | if the user follows the target user |
404 | if the user does not follow the target user |
Exemples de code pour « Check if a user follows another user »
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/users/USERNAME/following/TARGET_USERif the user follows the target user
Status: 204