Skip to main content

Эта версия GitHub Enterprise Server была прекращена 2024-03-26. Исправления выпускаться не будут даже при критических проблемах безопасности. Для повышения производительности, повышения безопасности и новых функций выполните обновление до последней версии GitHub Enterprise Server. Чтобы получить справку по обновлению, обратитесь в службу поддержки GitHub Enterprise.

После обновления экземпляра Enterprise Server администратором сайта до Enterprise Server 3.9 или более поздней версии, REST API будет версии. Сведения о том, как найти версию экземпляра, см. в разделе "Сведения о версиях документов GitHub". Дополнительные сведения см. в разделе "О управлении версиями 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"

Заголовки
Имя., Тип, 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>" \ http(s)://HOSTNAME/api/v3/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://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.

Параметры для "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>" \ http(s)://HOSTNAME/api/v3/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://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

Параметры для "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>" \ http(s)://HOSTNAME/api/v3/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"

Заголовки
Имя., Тип, 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>" \ http(s)://HOSTNAME/api/v3/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"

Заголовки
Имя., Тип, 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>" \ http(s)://HOSTNAME/api/v3/user/following/USERNAME

Response

Status: 204

List followers of a user

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). 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>" \ http(s)://HOSTNAME/api/v3/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://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.

Параметры для "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>" \ http(s)://HOSTNAME/api/v3/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://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

Параметры для "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>" \ http(s)://HOSTNAME/api/v3/users/USERNAME/following/TARGET_USER

if the user follows the target user

Status: 204