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.
About follower administration
If a request URL does not include a {username} parameter then the response will be for the signed-in user (and you must pass authentication information with your request). Additional private information, such as whether a user has two-factor authentication enabled, is included when authenticated through OAuth with the user scope.
List followers of the authenticated user
Lists the people following the authenticated user.
Jetons d’accès affinés pour « List followers of the authenticated user »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Followers" user permissions (read)
 
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" \
  https://api.github.com/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://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
  }
]List the people the authenticated user follows
Lists the people who the authenticated user follows.
Jetons d’accès affinés pour « List the people the authenticated user follows »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Followers" user permissions (read)
 
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" \
  https://api.github.com/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://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
  }
]Check if a person is followed by the authenticated user
Jetons d’accès affinés pour « Check if a person is followed by the authenticated user »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Followers" user permissions (read)
 
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" \
  https://api.github.com/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.
Jetons d’accès affinés pour « Follow a user »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Followers" user permissions (write)
 
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  | 
422 | Validation failed, or the endpoint has been spammed.  | 
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" \
  https://api.github.com/user/following/USERNAMEResponse
Status: 204Unfollow a user
OAuth app tokens and personal access tokens (classic) need the user:follow scope to use this endpoint.
Jetons d’accès affinés pour « Unfollow a user »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Followers" user permissions (write)
 
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" \
  https://api.github.com/user/following/USERNAMEResponse
Status: 204List followers of a user
Lists the people following the specified user.
Jetons d’accès affinés pour « List followers of a user »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application GitHub
 - Jetons d’accès d’installation d’application GitHub
 - Jetons d’accès personnel affiné
 
Le jeton précis ne nécessite aucune autorisation.
Ce point de terminaison peut être utilisé sans authentification ou si seules les ressources publiques sont demandées.
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 "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/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://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
  }
]List the people a user follows
Lists the people who the specified user follows.
Jetons d’accès affinés pour « List the people a user follows »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application GitHub
 - Jetons d’accès d’installation d’application GitHub
 - Jetons d’accès personnel affiné
 
Le jeton précis ne nécessite aucune autorisation.
Ce point de terminaison peut être utilisé sans authentification ou si seules les ressources publiques sont demandées.
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 "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/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://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
  }
]Check if a user follows another user
Jetons d’accès affinés pour « Check if a user follows another user »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application GitHub
 - Jetons d’accès d’installation d’application GitHub
 - Jetons d’accès personnel affiné
 
Le jeton précis ne nécessite aucune autorisation.
Ce point de terminaison peut être utilisé sans authentification ou si seules les ressources publiques sont demandées.
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 "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/users/USERNAME/following/TARGET_USERif the user follows the target user
Status: 204