事件的 REST API 端点
使用 REST API 与 GitHub 事件交互。
关于 GitHub 事件
GitHub 事件为网站上的各种活动流提供支持。
您可以使用 REST API 返回由 GitHub 上的活动触发的不同类型的事件。有关您可以接收的特定事件的更多信息,请参阅“GitHub 事件类型”。还提供用于存储库问题的端点。有关更多信息,请参阅“事件的 REST API 端点”。
事件针对使用“ETag”标头进行轮询进行了优化。如果未触发任何新事件,您将看到“304 未修改”响应,并且您当前的速率限制将保持不变。还有一个“X-Poll-Interval”标头,它指定允许您轮询的频率(以秒为单位)。在服务器负载高的时期,时间可能会增加。请遵守标头。
$ curl -I https://api.github.com/users/tater/events
> HTTP/2 200
> X-Poll-Interval: 60
> ETag: "a18c3bded88eb5dbb5c849a489412bf3"
# The quotes around the ETag value are important
$ curl -I https://api.github.com/users/tater/events \
$ -H 'If-None-Match: "a18c3bded88eb5dbb5c849a489412bf3"'
> HTTP/2 304
> X-Poll-Interval: 60
时间轴中只包含过去 90 天内创建的事件。超过 90 天的事件将不包括在内(即使时间轴中的事件总数少于 300)。
列出公共事件
我们将公共事件提要延迟五分钟,这意味着公共事件 API 返回的最新事件实际上至少发生在五分钟前。
用于“列出公共事件”的细粒度访问令牌
此端点与以下细粒度令牌类型一起使用
细粒度令牌不需要任何权限。
用于“列出公共事件”的参数
名称、类型、描述 |
---|
accept string 建议设置为 |
名称、类型、描述 |
---|
per_page integer 每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
“列出公共事件”的 HTTP 响应状态码
状态码 | 描述 |
---|---|
200 | OK |
304 | 未修改 |
403 | 禁止 |
503 | 服务不可用 |
“列出公共事件”的代码示例
请求示例
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/events
响应
状态:200
[ { "id": "22249084947", "type": "WatchEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "action": "started" }, "public": true, "created_at": "2022-06-09T12:47:28Z" }, { "id": "22249084964", "type": "PushEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "push_id": 10115855396, "size": 1, "distinct_size": 1, "ref": "refs/heads/master", "head": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "before": "883efe034920928c47fe18598c01249d1a9fdabd", "commits": [ { "sha": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "author": { "email": "[email protected]", "name": "Monalisa Octocat" }, "message": "commit", "distinct": true, "url": "https://api.github.com/repos/octocat/Hello-World/commits/7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300" } ] }, "public": true, "created_at": "2022-06-07T07:50:26Z" } ]
列出针对仓库网络的公共事件
针对“列出针对仓库网络的公共事件”的细粒度访问令牌
此端点与以下细粒度令牌类型一起使用
细粒度令牌不需要任何权限。
针对“列出针对仓库网络的公共事件”的参数
名称、类型、描述 |
---|
accept string 建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需仓库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需仓库的名称,不包括 |
名称、类型、描述 |
---|
per_page integer 每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
“列出网络中仓库的公共事件”的 HTTP 响应状态码
状态码 | 描述 |
---|---|
200 | OK |
301 | 永久移动 |
304 | 未修改 |
403 | 禁止 |
404 | 资源未找到 |
“列出网络中仓库的公共事件”的代码示例
请求示例
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/networks/OWNER/REPO/events
响应
状态:200
[ { "id": "22249084964", "type": "PushEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "push_id": 10115855396, "size": 1, "distinct_size": 1, "ref": "refs/heads/master", "head": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "before": "883efe034920928c47fe18598c01249d1a9fdabd", "commits": [ { "sha": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "author": { "email": "[email protected]", "name": "Monalisa Octocat" }, "message": "commit", "distinct": true, "url": "https://api.github.com/repos/octocat/Hello-World/commits/7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300" } ] }, "public": true, "created_at": "2022-06-09T12:47:28Z" }, { "id": "22237752260", "type": "WatchEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/rrubenich", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "action": "started" }, "public": true, "created_at": "2022-06-08T23:29:25Z" } ]
列出公共组织事件
“列出公共组织事件”的细粒度访问令牌
此端点与以下细粒度令牌类型一起使用
细粒度令牌不需要任何权限。
“列出公共组织事件”的参数
名称、类型、描述 |
---|
accept string 建议设置为 |
名称、类型、描述 |
---|
org 字符串 必需组织名称。名称不区分大小写。 |
名称、类型、描述 |
---|
per_page integer 每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
“列出公共组织事件”的 HTTP 响应状态码
状态码 | 描述 |
---|---|
200 | OK |
“列出公共组织事件”的代码示例
请求示例
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/orgs/ORG/events
响应
状态:200
[ { "id": "22237752260", "type": "WatchEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octo-org/octo-repo", "url": "https://api.github.com/repos/octo-org/octo-repo" }, "payload": { "action": "started" }, "public": true, "created_at": "2022-06-08T23:29:25Z" }, { "id": "22249084964", "type": "PushEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octo-org/octo-repo", "url": "https://api.github.com/repos/octo-org/oct-repo" }, "payload": { "push_id": 10115855396, "size": 1, "distinct_size": 1, "ref": "refs/heads/master", "head": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "before": "883efe034920928c47fe18598c01249d1a9fdabd", "commits": [ { "sha": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "author": { "email": "[email protected]", "name": "Monalisa Octocat" }, "message": "commit", "distinct": true, "url": "https://api.github.com/repos/octo-org/oct-repo/commits/7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300" } ] }, "public": true, "created_at": "2022-06-09T12:47:28Z" } ]
列出仓库事件
注意:此 API 未设计用于实时用例。根据一天中的时间,事件延迟可能在 30 秒到 6 小时之间。
用于“列出仓库事件”的细粒度访问令牌
此端点与以下细粒度令牌类型一起使用
细粒度令牌必须具有以下权限集
- "元数据" 仓库权限(读取)
如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。
用于“列出仓库事件”的参数
名称、类型、描述 |
---|
accept string 建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需仓库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需仓库的名称,不包括 |
名称、类型、描述 |
---|
per_page integer 每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
用于“列出仓库事件”的 HTTP 响应状态码
状态码 | 描述 |
---|---|
200 | OK |
用于“列出仓库事件”的代码示例
请求示例
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/repos/OWNER/REPO/events
响应
状态:200
[ { "id": "22249084964", "type": "PushEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "push_id": 10115855396, "size": 1, "distinct_size": 1, "ref": "refs/heads/master", "head": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "before": "883efe034920928c47fe18598c01249d1a9fdabd", "commits": [ { "sha": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "author": { "email": "[email protected]", "name": "Monalisa Octocat" }, "message": "commit", "distinct": true, "url": "https://api.github.com/repos/octocat/Hello-World/commits/7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300" } ] }, "public": true, "created_at": "2022-06-09T12:47:28Z" }, { "id": "22237752260", "type": "WatchEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "action": "started" }, "public": true, "created_at": "2022-06-08T23:29:25Z" } ]
列出经过身份验证用户的事件
如果您以给定用户身份进行身份验证,您将看到您的私人事件。否则,您只会看到公共事件。
用于“列出经过身份验证用户的事件”的细粒度访问令牌
此端点与以下细粒度令牌类型一起使用
细粒度令牌不需要任何权限。
用于“列出经过身份验证用户的事件”的参数
名称、类型、描述 |
---|
accept string 建议设置为 |
名称、类型、描述 |
---|
username string 必需GitHub 用户帐户的句柄。 |
名称、类型、描述 |
---|
per_page integer 每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
用于“列出经过身份验证用户的事件”的 HTTP 响应状态代码
状态码 | 描述 |
---|---|
200 | OK |
用于“列出经过身份验证用户的事件”的代码示例
请求示例
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/events
响应
状态:200
[ { "id": "22249084947", "type": "WatchEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "action": "started" }, "public": true, "created_at": "2022-06-09T12:47:28Z" }, { "id": "22249084964", "type": "PushEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "push_id": 10115855396, "size": 1, "distinct_size": 1, "ref": "refs/heads/master", "head": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "before": "883efe034920928c47fe18598c01249d1a9fdabd", "commits": [ { "sha": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "author": { "email": "[email protected]", "name": "Monalisa Octocat" }, "message": "commit", "distinct": true, "url": "https://api.github.com/repos/octocat/Hello-World/commits/7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300" } ] }, "public": false, "created_at": "2022-06-07T07:50:26Z" } ]
列出经过身份验证用户的组织事件
这是用户的组织仪表板。您必须以用户身份进行身份验证才能查看此内容。
针对“列出经过身份验证用户的组织事件”的细粒度访问令牌
此端点与以下细粒度令牌类型一起使用
细粒度令牌必须具有以下权限集
- “事件”组织权限(读取)
“列出经过身份验证用户的组织事件”的参数
名称、类型、描述 |
---|
accept string 建议设置为 |
名称、类型、描述 |
---|
username string 必需GitHub 用户帐户的句柄。 |
org 字符串 必需组织名称。名称不区分大小写。 |
名称、类型、描述 |
---|
per_page integer 每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
“列出经过身份验证用户的组织事件”的 HTTP 响应状态代码
状态码 | 描述 |
---|---|
200 | OK |
“列出经过身份验证用户的组织事件”的代码示例
请求示例
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/events/orgs/ORG
响应
状态:200
[ { "id": "22249084964", "type": "PushEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "push_id": 10115855396, "size": 1, "distinct_size": 1, "ref": "refs/heads/master", "head": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "before": "883efe034920928c47fe18598c01249d1a9fdabd", "commits": [ { "sha": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "author": { "email": "[email protected]", "name": "Monalisa Octocat" }, "message": "commit", "distinct": true, "url": "https://api.github.com/repos/octocat/Hello-World/commits/7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300" } ] }, "public": false, "created_at": "2022-06-09T12:47:28Z" }, { "id": "22196946742", "type": "CreateEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "ref": null, "ref_type": "repository", "master_branch": "master", "description": null, "pusher_type": "user" }, "public": false, "created_at": "2022-06-07T07:50:26Z", "org": { "id": 9919, "login": "github", "gravatar_id": "", "url": "https://api.github.com/orgs/github", "avatar_url": "https://avatars.githubusercontent.com/u/9919?" } } ]
列出用户的公开事件
针对“列出用户的公开事件”的细粒度访问令牌
此端点与以下细粒度令牌类型一起使用
细粒度令牌不需要任何权限。
“列出用户的公开事件”的参数
名称、类型、描述 |
---|
accept string 建议设置为 |
名称、类型、描述 |
---|
username string 必需GitHub 用户帐户的句柄。 |
名称、类型、描述 |
---|
per_page integer 每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
“列出用户的公开事件”的 HTTP 响应状态代码
状态码 | 描述 |
---|---|
200 | OK |
“列出用户的公开事件”的代码示例
请求示例
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/events/public
响应
状态:200
[ { "id": "22249084947", "type": "WatchEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "action": "started" }, "public": true, "created_at": "2022-06-09T12:47:28Z" }, { "id": "22249084964", "type": "PushEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "push_id": 10115855396, "size": 1, "distinct_size": 1, "ref": "refs/heads/master", "head": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "before": "883efe034920928c47fe18598c01249d1a9fdabd", "commits": [ { "sha": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "author": { "email": "[email protected]", "name": "Monalisa Octocat" }, "message": "commit", "distinct": true, "url": "https://api.github.com/repos/octocat/Hello-World/commits/7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300" } ] }, "public": true, "created_at": "2022-06-08T23:29:25Z" } ]
列出经过身份验证的用户接收到的事件
这些是您通过关注仓库和用户而接收到的事件。如果您以指定用户身份进行身份验证,您将看到私有事件。否则,您只会看到公开事件。
用于“列出经过身份验证的用户接收到的事件”的细粒度访问令牌
此端点与以下细粒度令牌类型一起使用
细粒度令牌不需要任何权限。
用于“列出经过身份验证的用户接收到的事件”的参数
名称、类型、描述 |
---|
accept string 建议设置为 |
名称、类型、描述 |
---|
username string 必需GitHub 用户帐户的句柄。 |
名称、类型、描述 |
---|
per_page integer 每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
用于“列出经过身份验证的用户接收到的事件”的 HTTP 响应状态代码
状态码 | 描述 |
---|---|
200 | OK |
用于“列出经过身份验证的用户接收到的事件”的代码示例
请求示例
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/received_events
响应
状态:200
[ { "id": "22249084964", "type": "PushEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "push_id": 10115855396, "size": 1, "distinct_size": 1, "ref": "refs/heads/master", "head": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "before": "883efe034920928c47fe18598c01249d1a9fdabd", "commits": [ { "sha": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "author": { "email": "[email protected]", "name": "Monalisa Octocat" }, "message": "commit", "distinct": true, "url": "https://api.github.com/repos/octocat/Hello-World/commits/7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300" } ] }, "public": true, "created_at": "2022-06-09T12:47:28Z" }, { "id": "22196946742", "type": "CreateEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "ref": null, "ref_type": "repository", "master_branch": "master", "description": null, "pusher_type": "user" }, "public": false, "created_at": "2022-06-07T07:50:26Z", "org": { "id": 9919, "login": "github", "gravatar_id": "", "url": "https://api.github.com/orgs/github", "avatar_url": "https://avatars.githubusercontent.com/u/9919?" } } ]
列出用户收到的公开事件
用于“列出用户收到的公开事件”的细粒度访问令牌
此端点与以下细粒度令牌类型一起使用
细粒度令牌不需要任何权限。
“列出用户收到的公开事件”的参数
名称、类型、描述 |
---|
accept string 建议设置为 |
名称、类型、描述 |
---|
username string 必需GitHub 用户帐户的句柄。 |
名称、类型、描述 |
---|
per_page integer 每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认: |
“列出用户收到的公开事件”的 HTTP 响应状态码
状态码 | 描述 |
---|---|
200 | OK |
“列出用户收到的公开事件”的代码示例
请求示例
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/received_events/public
响应
状态:200
[ { "id": "22249084964", "type": "PushEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "push_id": 10115855396, "size": 1, "distinct_size": 1, "ref": "refs/heads/master", "head": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "before": "883efe034920928c47fe18598c01249d1a9fdabd", "commits": [ { "sha": "7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300", "author": { "email": "[email protected]", "name": "Monalisa Octocat" }, "message": "commit", "distinct": true, "url": "https://api.github.com/repos/octocat/Hello-World/commits/7a8f3ac80e2ad2f6842cb86f576d4bfe2c03e300" } ] }, "public": true, "created_at": "2022-06-09T12:47:28Z" }, { "id": "22196946742", "type": "CreateEvent", "actor": { "id": 583231, "login": "octocat", "display_login": "octocat", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4" }, "repo": { "id": 1296269, "name": "octocat/Hello-World", "url": "https://api.github.com/repos/octocat/Hello-World" }, "payload": { "ref": null, "ref_type": "repository", "master_branch": "master", "description": null, "pusher_type": "user" }, "public": false, "created_at": "2022-06-07T07:50:26Z", "org": { "id": 9919, "login": "github", "gravatar_id": "", "url": "https://api.github.com/orgs/github", "avatar_url": "https://avatars.githubusercontent.com/u/9919?" } } ]