Skip to main content
REST API теперь версия. Дополнительные сведения см. в разделе "О управлении версиями API".

Конечные точки REST API для подписчиков

Используйте REST API для получения сведений о последователях прошедших проверку подлинности пользователей.

Сведения об администрировании подписчиков

Если URL-адрес запроса не содержит {username} параметр, ответ будет использоваться для пользователя, вошедшего в систему (и необходимо передать сведения о проверке подлинности с запросом). Дополнительные частные сведения, такие как включение двухфакторной проверки подлинности, включаются при проверке подлинности через OAuth с user область.

List followers of the authenticated user

Lists the people following the authenticated user.

Подробные маркеры доступа для "List followers of the authenticated user

Эта конечная точка работает со следующими типами маркеров:

Маркер должен иметь следующий набор разрешений.:

  • followers:read

Параметры для "List followers of the authenticated user"

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List followers of the authenticated user"

Код состоянияОписание
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Примеры кода для "List followers of the authenticated user"

Пример запроса

get/user/followers
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/followers

Response

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.

Подробные маркеры доступа для "List the people the authenticated user follows

Эта конечная точка работает со следующими типами маркеров:

Маркер должен иметь следующий набор разрешений.:

  • followers:read

Параметры для "List the people the authenticated user follows"

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List the people the authenticated user follows"

Код состоянияОписание
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Примеры кода для "List the people the authenticated user follows"

Пример запроса

get/user/following
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

Response

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

Подробные маркеры доступа для "Check if a person is followed by the authenticated user

Эта конечная точка работает со следующими типами маркеров:

Маркер должен иметь следующий набор разрешений.:

  • followers:read

Параметры для "Check if a person is followed by the authenticated user"

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
username string Обязательное поле

The handle for the GitHub user account.

Коды состояния http-ответа для "Check if a person is followed by the authenticated user"

Код состоянияОписание
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

Примеры кода для "Check if a person is followed by the authenticated user"

Пример запроса

get/user/following/{username}
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/USERNAME

if the person is followed by the authenticated user

Status: 204

Follow 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.

Подробные маркеры доступа для "Follow a user

Эта конечная точка работает со следующими типами маркеров:

Маркер должен иметь следующий набор разрешений.:

  • followers:write

Параметры для "Follow a user"

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
username string Обязательное поле

The handle for the GitHub user account.

Коды состояния http-ответа для "Follow a user"

Код состоянияОписание
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

Примеры кода для "Follow a user"

Пример запроса

put/user/following/{username}
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/USERNAME

Response

Status: 204

Unfollow a user

OAuth app tokens and personal access tokens (classic) need the user:follow scope to use this endpoint.

Подробные маркеры доступа для "Unfollow a user

Эта конечная точка работает со следующими типами маркеров:

Маркер должен иметь следующий набор разрешений.:

  • followers:write

Параметры для "Unfollow a user"

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
username string Обязательное поле

The handle for the GitHub user account.

Коды состояния http-ответа для "Unfollow a user"

Код состоянияОписание
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

Примеры кода для "Unfollow a user"

Пример запроса

delete/user/following/{username}
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/USERNAME

Response

Status: 204

List followers of a user

Lists the people following the specified user.

Подробные маркеры доступа для "List followers of a user

Эта конечная точка работает со следующими типами маркеров:

Маркер не требует каких-либо разрешений.

Параметры для "List followers of a user"

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
username string Обязательное поле

The handle for the GitHub user account.

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List followers of a user"

Код состоянияОписание
200

OK

Примеры кода для "List followers of a user"

Пример запроса

get/users/{username}/followers
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/users/USERNAME/followers

Response

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.

Подробные маркеры доступа для "List the people a user follows

Эта конечная точка работает со следующими типами маркеров:

Маркер не требует каких-либо разрешений.

Параметры для "List the people a user follows"

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
username string Обязательное поле

The handle for the GitHub user account.

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

Коды состояния http-ответа для "List the people a user follows"

Код состоянияОписание
200

OK

Примеры кода для "List the people a user follows"

Пример запроса

get/users/{username}/following
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/users/USERNAME/following

Response

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

Подробные маркеры доступа для "Check if a user follows another user

Эта конечная точка работает со следующими типами маркеров:

Маркер не требует каких-либо разрешений.

Параметры для "Check if a user follows another user"

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
username string Обязательное поле

The handle for the GitHub user account.

target_user string Обязательное поле

Коды состояния http-ответа для "Check if a user follows another user"

Код состоянияОписание
204

if the user follows the target user

404

if the user does not follow the target user

Примеры кода для "Check if a user follows another user"

Пример запроса

get/users/{username}/following/{target_user}
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/users/USERNAME/following/TARGET_USER

if the user follows the target user

Status: 204