Esta versão do GitHub Enterprise Server foi descontinuada em 2024-03-26. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, segurança aprimorada e novos recursos, atualize para a última versão do GitHub Enterprise Server. Para obter ajuda com a atualização, entre em contato com o suporte do GitHub Enterprise.
Pontos de extremidade de API REST para seguidores
Use a API REST para obter informações sobre seguidores de usuários autenticados.
Sobre a administração de seguidores
Se uma URL de solicitação não incluir um parâmetro {username}, a resposta será para o usuário conectado (e você deverá passar informações de autenticação com sua solicitação). Informações privadas adicionais, como se um usuário tem a autenticação de dois fatores habilitada, são incluídas quando autenticadas por meio da Autenticação Básica  ou  OAuth com o escopo user.
List followers of the authenticated user
Lists the people following the authenticated user.
Parâmetros para "List followers of the authenticated user"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão:  | 
| pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão:  | 
Códigos de status de resposta HTTP para "List followers of the authenticated user"
| Código de status | Descrição | 
|---|---|
| 200 | OK | 
| 304 | Not modified | 
| 401 | Requires authentication | 
| 403 | Forbidden | 
Exemplos de código para "List followers of the authenticated user"
Exemplo de solicitação
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  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.
Parâmetros para "List the people the authenticated user follows"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão:  | 
| pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão:  | 
Códigos de status de resposta HTTP para "List the people the authenticated user follows"
| Código de status | Descrição | 
|---|---|
| 200 | OK | 
| 304 | Not modified | 
| 401 | Requires authentication | 
| 403 | Forbidden | 
Exemplos de código para "List the people the authenticated user follows"
Exemplo de solicitação
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  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
Parâmetros para "Check if a person is followed by the authenticated user"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| usernamestring ObrigatórioThe handle for the GitHub user account. | 
Códigos de status de resposta HTTP para "Check if a person is followed by the authenticated user"
| Código de status | Descrição | 
|---|---|
| 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 | 
Exemplos de código para "Check if a person is followed by the authenticated user"
Exemplo de solicitação
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  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.
Parâmetros para "Follow a user"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| usernamestring ObrigatórioThe handle for the GitHub user account. | 
Códigos de status de resposta HTTP para "Follow a user"
| Código de status | Descrição | 
|---|---|
| 204 | No Content | 
| 304 | Not modified | 
| 401 | Requires authentication | 
| 403 | Forbidden | 
| 404 | Resource not found | 
Exemplos de código para "Follow a user"
Exemplo de solicitação
curl -L \
  -X PUT \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  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.
Parâmetros para "Unfollow a user"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| usernamestring ObrigatórioThe handle for the GitHub user account. | 
Códigos de status de resposta HTTP para "Unfollow a user"
| Código de status | Descrição | 
|---|---|
| 204 | No Content | 
| 304 | Not modified | 
| 401 | Requires authentication | 
| 403 | Forbidden | 
| 404 | Resource not found | 
Exemplos de código para "Unfollow a user"
Exemplo de solicitação
curl -L \
  -X DELETE \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  http(s)://HOSTNAME/api/v3/user/following/USERNAMEResponse
Status: 204List followers of a user
Lists the people following the specified user.
Parâmetros para "List followers of a user"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| usernamestring ObrigatórioThe handle for the GitHub user account. | 
| Nome, Tipo, Descrição | 
|---|
| per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão:  | 
| pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão:  | 
Códigos de status de resposta HTTP para "List followers of a user"
| Código de status | Descrição | 
|---|---|
| 200 | OK | 
Exemplos de código para "List followers of a user"
Exemplo de solicitação
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  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.
Parâmetros para "List the people a user follows"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| usernamestring ObrigatórioThe handle for the GitHub user account. | 
| Nome, Tipo, Descrição | 
|---|
| per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão:  | 
| pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão:  | 
Códigos de status de resposta HTTP para "List the people a user follows"
| Código de status | Descrição | 
|---|---|
| 200 | OK | 
Exemplos de código para "List the people a user follows"
Exemplo de solicitação
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  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
Parâmetros para "Check if a user follows another user"
| Nome, Tipo, Descrição | 
|---|
| acceptstringSetting to  | 
| Nome, Tipo, Descrição | 
|---|
| usernamestring ObrigatórioThe handle for the GitHub user account. | 
| target_userstring Obrigatório | 
Códigos de status de resposta HTTP para "Check if a user follows another user"
| Código de status | Descrição | 
|---|---|
| 204 | if the user follows the target user | 
| 404 | if the user does not follow the target user | 
Exemplos de código para "Check if a user follows another user"
Exemplo de solicitação
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  http(s)://HOSTNAME/api/v3/users/USERNAME/following/TARGET_USERif the user follows the target user
Status: 204