Skip to main content

Diese Version von GitHub Enterprise Server wurde eingestellt am 2024-03-26. Es wird keine Patch-Freigabe vorgenommen, auch nicht für kritische Sicherheitsprobleme. Für bessere Leistung, verbesserte Sicherheit und neue Features aktualisiere auf die neueste Version von GitHub Enterprise Server. Wende dich an den GitHub Enterprise-Support, um Hilfe zum Upgrade zu erhalten.

Nachdem deine Enterprise Server-Instanz durch Websiteadministrator*innen auf Enterprise Server 3.9 oder höher aktualisiert wurde, erhält die REST-API eine Versionskontrolle. Weitere Informationen zum Ermitteln der Version deiner Instanz findest du unter Informationen zu Versionen der GitHub-Dokumentation. Weitere Informationen findest du unter Informationen zur API-Versionsverwaltung.

REST-API-Endpunkte für Benachrichtigungen

Verwende die REST-API, um GitHub Enterprise Server-Benachrichtigungen zu verwalten.

Informationen zu GitHub Enterprise Server-Benachrichtigungen

Du kannst die REST-API verwenden, um GitHub Enterprise Server-Benachrichtigungen zu verwalten. Weitere Informationen zu Benachrichtigungen findest du unter Informationen zu Benachrichtigungen.

Für alle Aufrufe dieser Endpunkte ist der Bereich notifications oder repo erforderlich. Du benötigst außerdem den Bereich repo, um von den jeweiligen Endpunkten aus auf Issues und Commits zuzugreifen.

Benachrichtigungen werden als „Threads“ zurückgegeben. Ein Thread enthält Informationen zur aktuellen Diskussion eines Issues, eines Pull Requests oder eines Commits.

Benachrichtigungen werden für den Abruf mit dem Last-Modified-Header optimiert. Wenn keine neuen Benachrichtigungen vorliegen, wird eine 304 Not Modified-Antwort angezeigt, und die aktuelle Ratenbegrenzung bleibt unberührt. Es gibt einen X-Poll-Interval-Header, der angibt, wie oft der Abruf erfolgen darf (in Sekunden). In Zeiten hoher Serverlast kann dieser Zeitraum erhöht werden. Beachte den Header.

# Add authentication to your requests
$ curl -I http(s)://<em>HOSTNAME</em>/api/v3/notifications
HTTP/2 200
Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT
X-Poll-Interval: 60

# Pass the Last-Modified header exactly
$ curl -I http(s)://<em>HOSTNAME</em>/api/v3/notifications
$    -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT"
> HTTP/2 304
> X-Poll-Interval: 60

Informationen zu Benachrichtigungsgründen

Diese GET-Endpunkte geben einen reason-Schlüssel zurück. Diese reasons sind Ereignissen zugeordnet, die eine Benachrichtigung auslösen.

Für den Empfang einer Benachrichtigung sind einige reason-Angaben möglich.

Name des GrundsBeschreibung
approval_requestedSie wurden gebeten, eine Bereitstellung zu überprüfen und zu genehmigen. Weitere Informationen findest du unter Überprüfen von Bereitstellungen.
assignDas Issue wurde dir zugewiesen.
authorDu hast den Thread erstellt.
commentDu hast den Thread kommentiert.
ci_activityEine von dir ausgelöste GitHub Actions-Workflowausführung wurde abgeschlossen.
invitationDu hast eine Einladung zum Mitwirken am Repository angenommen.
manualDu hast den Thread abonniert (über ein Issue oder einen Pull Request).
member_feature_requestedOrganisationsmitglieder haben gebeten, ein Feature wie Draft Pull Requests oder CoPilot zu aktivieren.
mentionDu wurdest im Inhalt über @mentioned explizit erwähnt.
review_requestedDu oder ein Team, in dem du Mitglied bist, wurde aufgefordert, einen Pull Request zu überprüfen.
security_advisory_creditIhnen wurde die Mitwirkung an einer Sicherheitsempfehlung gutgeschrieben.
state_changeDu hast den Threadstatus geändert (z. B. durch Schließen eines Issues oder Mergen eines Pull Requests).
subscribedDu überwachst das Repository.
team_mentionDu bist Mitglied eines Teams, das erwähnt wurde.

Beachte, dass reason auf Threadbasis geändert wird und sich ändern kann, wenn die reason-Angabe für eine spätere Benachrichtigung anders lautet.

Wenn du beispielsweise der Autor eines Issues bist, weist reason bei nachfolgenden Benachrichtigungen zu diesem Issue den Wert author auf. Wenn du dann in demselben Issue über @mentioned erwähnt wirst, verfügen danach abgerufene Benachrichtigungen über den reason-Wert mention. Diese reason-Angabe bleibt mention unabhängig davon, ob du jemals wieder erwähnt wirst.

List notifications for the authenticated user

List all notifications for the current user, sorted by most recently updated.

Parameter für „List notifications for the authenticated user“

Header
Name, type, BESCHREIBUNG
accept string

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

Abfrageparameter
Name, type, BESCHREIBUNG
all boolean

If true, show notifications marked as read.

Standard: false

participating boolean

If true, only shows notifications in which the user is directly participating or mentioned.

Standard: false

since string

Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

before string

Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

page integer

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

Standard: 1

per_page integer

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

Standard: 50

HTTP-Antwortstatuscodes für „List notifications for the authenticated user“

StatuscodeBESCHREIBUNG
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

422

Validation failed, or the endpoint has been spammed.

Codebeispiele für „List notifications for the authenticated user“

Beispiel für eine Anfrage

get/notifications
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/notifications

Response

Status: 200
[ { "id": "1", "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "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 }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://HOSTNAME/repos/octocat/Hello-World", "archive_url": "https://HOSTNAME/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://HOSTNAME/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://HOSTNAME/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://HOSTNAME/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://HOSTNAME/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://HOSTNAME/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://HOSTNAME/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://HOSTNAME/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://HOSTNAME/repos/octocat/Hello-World/contributors", "deployments_url": "https://HOSTNAME/repos/octocat/Hello-World/deployments", "downloads_url": "https://HOSTNAME/repos/octocat/Hello-World/downloads", "events_url": "https://HOSTNAME/repos/octocat/Hello-World/events", "forks_url": "https://HOSTNAME/repos/octocat/Hello-World/forks", "git_commits_url": "https://HOSTNAME/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://HOSTNAME/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://HOSTNAME/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://HOSTNAME/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://HOSTNAME/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://HOSTNAME/repos/octocat/Hello-World/languages", "merges_url": "https://HOSTNAME/repos/octocat/Hello-World/merges", "milestones_url": "https://HOSTNAME/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://HOSTNAME/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://HOSTNAME/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://HOSTNAME/repos/octocat/Hello-World/releases{/id}", "ssh_url": "git@github.com:octocat/Hello-World.git", "stargazers_url": "https://HOSTNAME/repos/octocat/Hello-World/stargazers", "statuses_url": "https://HOSTNAME/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://HOSTNAME/repos/octocat/Hello-World/subscribers", "subscription_url": "https://HOSTNAME/repos/octocat/Hello-World/subscription", "tags_url": "https://HOSTNAME/repos/octocat/Hello-World/tags", "teams_url": "https://HOSTNAME/repos/octocat/Hello-World/teams", "trees_url": "https://HOSTNAME/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "http://HOSTNAME/repos/octocat/Hello-World/hooks" }, "subject": { "title": "Greetings", "url": "https://HOSTNAME/repos/octokit/octokit.rb/issues/123", "latest_comment_url": "https://HOSTNAME/repos/octokit/octokit.rb/issues/comments/123", "type": "Issue" }, "reason": "subscribed", "unread": true, "updated_at": "2014-11-07T22:01:45Z", "last_read_at": "2014-11-07T22:01:45Z", "url": "https://HOSTNAME/notifications/threads/1", "subscription_url": "https://HOSTNAME/notifications/threads/1/subscription" } ]

Mark notifications as read

Marks all notifications as "read" for the current user. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub Enterprise Server will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List notifications for the authenticated user endpoint and pass the query parameter all=false.

Parameter für „Mark notifications as read“

Header
Name, type, BESCHREIBUNG
accept string

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

Textparameter
Name, type, BESCHREIBUNG
last_read_at string

Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: The current timestamp.

read boolean

Whether the notification has been read.

HTTP-Antwortstatuscodes für „Mark notifications as read“

StatuscodeBESCHREIBUNG
202

Accepted

205

Reset Content

304

Not modified

401

Requires authentication

403

Forbidden

Codebeispiele für „Mark notifications as read“

Beispiel für eine Anfrage

put/notifications
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/notifications \ -d '{"last_read_at":"2022-06-10T00:00:00Z","read":true}'

Response

Status: 202
{ "message": "Unread notifications couldn't be marked in a single request. Notifications are being marked as read in the background." }

Get a thread

Gets information about a notification thread.

Parameter für „Get a thread“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
thread_id integer Erforderlich

The unique identifier of the notification thread. This corresponds to the value returned in the id field when you retrieve notifications (for example with the GET /notifications operation).

HTTP-Antwortstatuscodes für „Get a thread“

StatuscodeBESCHREIBUNG
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Codebeispiele für „Get a thread“

Beispiel für eine Anfrage

get/notifications/threads/{thread_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/notifications/threads/THREAD_ID

Response

Status: 200
{ "id": "1", "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "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 }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://HOSTNAME/repos/octocat/Hello-World", "archive_url": "https://HOSTNAME/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://HOSTNAME/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://HOSTNAME/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://HOSTNAME/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://HOSTNAME/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://HOSTNAME/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://HOSTNAME/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://HOSTNAME/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://HOSTNAME/repos/octocat/Hello-World/contributors", "deployments_url": "https://HOSTNAME/repos/octocat/Hello-World/deployments", "downloads_url": "https://HOSTNAME/repos/octocat/Hello-World/downloads", "events_url": "https://HOSTNAME/repos/octocat/Hello-World/events", "forks_url": "https://HOSTNAME/repos/octocat/Hello-World/forks", "git_commits_url": "https://HOSTNAME/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://HOSTNAME/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://HOSTNAME/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://HOSTNAME/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://HOSTNAME/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://HOSTNAME/repos/octocat/Hello-World/languages", "merges_url": "https://HOSTNAME/repos/octocat/Hello-World/merges", "milestones_url": "https://HOSTNAME/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://HOSTNAME/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://HOSTNAME/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://HOSTNAME/repos/octocat/Hello-World/releases{/id}", "ssh_url": "git@github.com:octocat/Hello-World.git", "stargazers_url": "https://HOSTNAME/repos/octocat/Hello-World/stargazers", "statuses_url": "https://HOSTNAME/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://HOSTNAME/repos/octocat/Hello-World/subscribers", "subscription_url": "https://HOSTNAME/repos/octocat/Hello-World/subscription", "tags_url": "https://HOSTNAME/repos/octocat/Hello-World/tags", "teams_url": "https://HOSTNAME/repos/octocat/Hello-World/teams", "trees_url": "https://HOSTNAME/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "http://HOSTNAME/repos/octocat/Hello-World/hooks" }, "subject": { "title": "Greetings", "url": "https://HOSTNAME/repos/octokit/octokit.rb/issues/123", "latest_comment_url": "https://HOSTNAME/repos/octokit/octokit.rb/issues/comments/123", "type": "Issue" }, "reason": "subscribed", "unread": true, "updated_at": "2014-11-07T22:01:45Z", "last_read_at": "2014-11-07T22:01:45Z", "url": "https://HOSTNAME/notifications/threads/1", "subscription_url": "https://HOSTNAME/notifications/threads/1/subscription" }

Mark a thread as read

Marks a thread as "read." Marking a thread as "read" is equivalent to clicking a notification in your notification inbox on GitHub Enterprise Server: https://github.com/notifications.

Parameter für „Mark a thread as read“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
thread_id integer Erforderlich

The unique identifier of the notification thread. This corresponds to the value returned in the id field when you retrieve notifications (for example with the GET /notifications operation).

HTTP-Antwortstatuscodes für „Mark a thread as read“

StatuscodeBESCHREIBUNG
205

Reset Content

304

Not modified

403

Forbidden

Codebeispiele für „Mark a thread as read“

Beispiel für eine Anfrage

patch/notifications/threads/{thread_id}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/notifications/threads/THREAD_ID

Reset Content

Status: 205

Get a thread subscription for the authenticated user

This checks to see if the current user is subscribed to a thread. You can also get a repository subscription.

Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were @mentioned, or manually subscribe to a thread.

Parameter für „Get a thread subscription for the authenticated user“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
thread_id integer Erforderlich

The unique identifier of the notification thread. This corresponds to the value returned in the id field when you retrieve notifications (for example with the GET /notifications operation).

HTTP-Antwortstatuscodes für „Get a thread subscription for the authenticated user“

StatuscodeBESCHREIBUNG
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Codebeispiele für „Get a thread subscription for the authenticated user“

Beispiel für eine Anfrage

get/notifications/threads/{thread_id}/subscription
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/notifications/threads/THREAD_ID/subscription

Response

Status: 200
{ "subscribed": true, "ignored": false, "reason": null, "created_at": "2012-10-06T21:34:12Z", "url": "https://HOSTNAME/notifications/threads/1/subscription", "thread_url": "https://HOSTNAME/notifications/threads/1" }

Set a thread subscription

If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an @mention.

You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored.

Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the Delete a thread subscription endpoint.

Parameter für „Set a thread subscription“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
thread_id integer Erforderlich

The unique identifier of the notification thread. This corresponds to the value returned in the id field when you retrieve notifications (for example with the GET /notifications operation).

Textparameter
Name, type, BESCHREIBUNG
ignored boolean

Whether to block all notifications from a thread.

Standard: false

HTTP-Antwortstatuscodes für „Set a thread subscription“

StatuscodeBESCHREIBUNG
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Codebeispiele für „Set a thread subscription“

Beispiel für eine Anfrage

put/notifications/threads/{thread_id}/subscription
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/notifications/threads/THREAD_ID/subscription \ -d '{"ignored":false}'

Response

Status: 200
{ "subscribed": true, "ignored": false, "reason": null, "created_at": "2012-10-06T21:34:12Z", "url": "https://HOSTNAME/notifications/threads/1/subscription", "thread_url": "https://HOSTNAME/notifications/threads/1" }

Delete a thread subscription

Mutes all future notifications for a conversation until you comment on the thread or get an @mention. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the Set a thread subscription endpoint and set ignore to true.

Parameter für „Delete a thread subscription“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
thread_id integer Erforderlich

The unique identifier of the notification thread. This corresponds to the value returned in the id field when you retrieve notifications (for example with the GET /notifications operation).

HTTP-Antwortstatuscodes für „Delete a thread subscription“

StatuscodeBESCHREIBUNG
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

Codebeispiele für „Delete a thread subscription“

Beispiel für eine Anfrage

delete/notifications/threads/{thread_id}/subscription
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/notifications/threads/THREAD_ID/subscription

Response

Status: 204

List repository notifications for the authenticated user

Lists all notifications for the current user in the specified repository.

Parameter für „List repository notifications for the authenticated user“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository without the .git extension. The name is not case sensitive.

Abfrageparameter
Name, type, BESCHREIBUNG
all boolean

If true, show notifications marked as read.

Standard: false

participating boolean

If true, only shows notifications in which the user is directly participating or mentioned.

Standard: false

since string

Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

before string

Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

per_page integer

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

Standard: 30

page integer

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

Standard: 1

HTTP-Antwortstatuscodes für „List repository notifications for the authenticated user“

StatuscodeBESCHREIBUNG
200

OK

Codebeispiele für „List repository notifications for the authenticated user“

Beispiel für eine Anfrage

get/repos/{owner}/{repo}/notifications
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/notifications

Response

Status: 200
[ { "id": "1", "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "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 }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://HOSTNAME/repos/octocat/Hello-World", "archive_url": "https://HOSTNAME/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://HOSTNAME/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://HOSTNAME/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://HOSTNAME/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://HOSTNAME/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://HOSTNAME/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://HOSTNAME/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://HOSTNAME/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://HOSTNAME/repos/octocat/Hello-World/contributors", "deployments_url": "https://HOSTNAME/repos/octocat/Hello-World/deployments", "downloads_url": "https://HOSTNAME/repos/octocat/Hello-World/downloads", "events_url": "https://HOSTNAME/repos/octocat/Hello-World/events", "forks_url": "https://HOSTNAME/repos/octocat/Hello-World/forks", "git_commits_url": "https://HOSTNAME/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://HOSTNAME/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://HOSTNAME/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://HOSTNAME/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://HOSTNAME/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://HOSTNAME/repos/octocat/Hello-World/languages", "merges_url": "https://HOSTNAME/repos/octocat/Hello-World/merges", "milestones_url": "https://HOSTNAME/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://HOSTNAME/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://HOSTNAME/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://HOSTNAME/repos/octocat/Hello-World/releases{/id}", "ssh_url": "git@github.com:octocat/Hello-World.git", "stargazers_url": "https://HOSTNAME/repos/octocat/Hello-World/stargazers", "statuses_url": "https://HOSTNAME/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://HOSTNAME/repos/octocat/Hello-World/subscribers", "subscription_url": "https://HOSTNAME/repos/octocat/Hello-World/subscription", "tags_url": "https://HOSTNAME/repos/octocat/Hello-World/tags", "teams_url": "https://HOSTNAME/repos/octocat/Hello-World/teams", "trees_url": "https://HOSTNAME/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "http://HOSTNAME/repos/octocat/Hello-World/hooks" }, "subject": { "title": "Greetings", "url": "https://HOSTNAME/repos/octokit/octokit.rb/issues/123", "latest_comment_url": "https://HOSTNAME/repos/octokit/octokit.rb/issues/comments/123", "type": "Issue" }, "reason": "subscribed", "unread": true, "updated_at": "2014-11-07T22:01:45Z", "last_read_at": "2014-11-07T22:01:45Z", "url": "https://HOSTNAME/notifications/threads/1", "subscription_url": "https://HOSTNAME/notifications/threads/1/subscription" } ]

Mark repository notifications as read

Marks all notifications in a repository as "read" for the current user. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub Enterprise Server will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List repository notifications for the authenticated user endpoint and pass the query parameter all=false.

Parameter für „Mark repository notifications as read“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository without the .git extension. The name is not case sensitive.

Textparameter
Name, type, BESCHREIBUNG
last_read_at string

Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: The current timestamp.

HTTP-Antwortstatuscodes für „Mark repository notifications as read“

StatuscodeBESCHREIBUNG
202

Accepted

205

Reset Content

Codebeispiele für „Mark repository notifications as read“

Beispiel für eine Anfrage

put/repos/{owner}/{repo}/notifications
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/notifications \ -d '{"last_read_at":"2019-01-01T00:00:00Z"}'

Response

Status: 202
{ "message": "Unread notifications couldn't be marked in a single request. Notifications are being marked as read in the background." }