事件的 REST API 终结点
使用 REST API 与 GitHub 事件交互。
关于 GitHub 事件
GitHub 事件推动站点上的各种活动流。
可以使用 REST API 返回由 GitHub 上的活动触发的不同类型的事件。 有关可接收的特定事件的详细信息,请参阅“GitHub 事件类型”。 也可使用存储库问题的终结点。 有关详细信息,请参阅“适用于问题事件的 REST API 终结点”。
事件针对使用 "ETag" 标头的轮询进行了优化。 如果未触发任何新事件,你将会看到一个 "304 Not Modified" 响应,并且你的当前速率限制不受影响。 还有一个 "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 个)。
List public events
Note
This API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.
“List public events”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌不需要任何权限。
“List public events”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 默认: |
“List public events”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden |
503 | Service unavailable |
“List public events”的示例代码
请求示例
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
Response
Status: 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": "octocat@github.com",
"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"
}
]
List public events for a network of repositories
Note
This API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.
“List public events for a network of repositories”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌不需要任何权限。
“List public events for a network of repositories”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 默认: |
“List public events for a network of repositories”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
301 | Moved permanently |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
“List public events for a network of repositories”的示例代码
请求示例
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
Response
Status: 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": "octocat@github.com",
"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"
}
]
List public organization events
Note
This API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.
“List public organization events”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌不需要任何权限。
“List public organization events”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 默认: |
“List public organization events”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List public organization events”的示例代码
请求示例
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
Response
Status: 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": "octocat@github.com",
"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"
}
]
List repository events
Note
This API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.
“List repository events”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Metadata" repository permissions (read)
如果仅请求公共资源,则无需身份验证或上述权限即可使用此终结点。
“List repository events”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 默认: |
“List repository events”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List repository events”的示例代码
请求示例
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
Response
Status: 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": "octocat@github.com",
"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"
}
]
List events for the authenticated user
If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. Optional: use the fine-grained token with following permission set to view private events: "Events" user permissions (read).
Note
This API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.
“List events for the authenticated user”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌不需要任何权限。
“List events for the authenticated user”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
username string 必须The handle for the GitHub user account. |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 默认: |
“List events for the authenticated user”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List events for the authenticated 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/events
Response
Status: 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": "octocat@github.com",
"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"
}
]
List organization events for the authenticated user
This is the user's organization dashboard. You must be authenticated as the user to view this.
Note
This API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.
“List organization events for the authenticated user”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌必须具有以下权限集:
- "Events" organization permissions (read)
“List organization events for the authenticated user”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
username string 必须The handle for the GitHub user account. |
org string 必须The organization name. The name is not case sensitive. |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 默认: |
“List organization events for the authenticated user”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List organization events for the authenticated 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/events/orgs/ORG
Response
Status: 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": "octocat@github.com",
"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?"
}
}
]
List public events for a user
Note
This API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.
“List public events for a user”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌不需要任何权限。
“List public events for a user”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
username string 必须The handle for the GitHub user account. |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 默认: |
“List public events for a user”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List public events for a 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/events/public
Response
Status: 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": "octocat@github.com",
"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"
}
]
List events received by the authenticated user
These are events that you've received by watching repositories and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events.
Note
This API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.
“List events received by the authenticated user”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌不需要任何权限。
“List events received by the authenticated user”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
username string 必须The handle for the GitHub user account. |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 默认: |
“List events received by the authenticated user”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List events received by the authenticated 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/received_events
Response
Status: 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": "octocat@github.com",
"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?"
}
}
]
List public events received by a user
Note
This API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.
“List public events received by a user”的细粒度访问令牌
此端点支持以下精细令牌类型:
精细令牌不需要任何权限。
“List public events received by a user”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
username string 必须The handle for the GitHub user account. |
名称, 类型, 说明 |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." 默认: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." 默认: |
“List public events received by a user”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List public events received by a 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/received_events/public
Response
Status: 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": "octocat@github.com",
"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?"
}
}
]