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

Followers

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

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

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

List followers of the authenticated user

Lists the people following the authenticated user.

Параметры для "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).

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

page integer

Page number of the results to fetch.

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

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

Код состоянияDescription
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"

Заголовки
Имя, Вид, Description
accept string

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

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

The number of results per page (max 100).

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

page integer

Page number of the results to fetch.

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

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

Код состоянияDescription
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"

Заголовки
Имя, Вид, 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"

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

Примеры кода для "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."

Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.

Параметры для "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"

Код состоянияDescription
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

Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.

Параметры для "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"

Код состоянияDescription
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

Совместим с GitHub Apps

Lists the people following the specified 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).

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

page integer

Page number of the results to fetch.

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

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

Код состоянияDescription
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

Совместим с GitHub Apps

Lists the people who the specified 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).

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

page integer

Page number of the results to fetch.

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

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

Код состоянияDescription
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

Совместим с GitHub Apps

Параметры для "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"

Код состоянияDescription
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