This version of GitHub Enterprise was discontinued on 2023-07-06. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.
Watching
Use the REST API to subscribe to notifications for activity in a repository.
About watching
You can use the REST API to subscribe to notifications for activity in a repository. To bookmark a repository instead, see "Starring."
Watching versus starring
In August 2012, we changed the way watching works on GitHub. Some API client applications may still be using the original "watcher" endpoints for accessing this data. You should now use the "star" endpoints instead. For more information, see the REST API "Starring" documentation and the Watcher API Change post.
In responses from the REST API, subscribers_count corresponds to the number of watchers, whereas watchers, watchers_count, and stargazers_count correspond to the number of users that have starred a repository.
List watchers
Lists the people watching the specified repository.
Parameters for "List watchers"
| Headers |
|---|
| Name, Type, Description |
accept string Setting to |
| Path parameters |
| Name, Type, Description |
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
| Query parameters |
| Name, Type, Description |
per_page integer The number of results per page (max 100). Default: |
page integer Page number of the results to fetch. Default: |
HTTP response status codes for "List watchers"
| Status code | Description |
|---|---|
200 | OK |
Code samples for "List watchers"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/subscribersResponse
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
}
]Get a repository subscription
Gets information about whether the authenticated user is subscribed to the repository.
Parameters for "Get a repository subscription"
| Headers |
|---|
| Name, Type, Description |
accept string Setting to |
| Path parameters |
| Name, Type, Description |
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
HTTP response status codes for "Get a repository subscription"
| Status code | Description |
|---|---|
200 | if you subscribe to the repository |
403 | Forbidden |
404 | Not Found if you don't subscribe to the repository |