跳至主要内容
REST API 现已版本化。 有关详细信息,请参阅“关于 API 版本控制”。

反应的 REST API 端点

使用 REST API 与 GitHub 上的反应进行交互。

关于反应

您可以在 GitHub 上创建和管理对评论、问题、请求和讨论的反应。创建反应时,content 参数允许的值如下(并带有相应的 emoji 以供参考)

内容 表情
+1 👍
-1 👎
laugh 😄
confused 😕
heart ❤️
hooray 🎉
rocket 🚀
eyes 👀

列出团队讨论评论的反应

列出对 团队讨论评论 的反应。

注意:您还可以使用路由 GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactionsorg_idteam_id 指定团队。

OAuth 应用令牌和个人访问令牌(经典)需要 read:discussion 范围才能使用此端点。

“列出团队讨论评论的反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
org string 必需

组织名称。名称不区分大小写。

team_slug string 必需

团队名称的 slug。

discussion_number integer 必需

标识讨论的数字。

comment_number integer 必需

标识评论的数字。

查询参数
名称、类型、说明
content 字符串

返回单个 反应类型。省略此参数可列出团队讨论评论的所有反应。

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

per_page 整数

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 30

page 整数

要获取的结果的页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 1

“列出团队讨论评论的反应”的 HTTP 响应状态代码

状态代码说明
200

OK

“列出团队讨论评论的反应”的代码示例

请求示例

get/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
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/teams/TEAM_SLUG/discussions/DISCUSSION_NUMBER/comments/COMMENT_NUMBER/reactions

响应

状态:200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" } ]

为团队讨论评论创建反应

团队讨论评论 创建反应。

HTTP 200 状态的响应表示你已将反应类型添加到此团队讨论评论。

注意:您还可以使用路由POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions通过org_idteam_id指定一个团队。

OAuth 应用令牌和个人访问令牌(经典)需要write:discussion范围才能使用此端点。

“为团队讨论评论创建反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
org string 必需

组织名称。名称不区分大小写。

team_slug string 必需

团队名称的 slug。

discussion_number integer 必需

标识讨论的数字。

comment_number integer 必需

标识评论的数字。

正文参数
名称、类型、说明
content string 必需

要添加到团队讨论评论的反应类型

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

“为团队讨论评论创建反应”的 HTTP 响应状态代码

状态代码说明
200

当反应类型已添加到此团队讨论评论时的响应

201

已创建

“为团队讨论评论创建反应”的代码示例

请求示例

post/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
curl -L \ -X POST \ -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/teams/TEAM_SLUG/discussions/DISCUSSION_NUMBER/comments/COMMENT_NUMBER/reactions \ -d '{"content":"heart"}'

当反应类型已添加到此团队讨论评论时的响应

状态:200
{ "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" }

删除团队讨论评论反应

注意:您还可以使用路由DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id通过team_idorg_id指定一个团队或组织。

删除对 团队讨论评论 的反应。

OAuth 应用令牌和个人访问令牌(经典)需要write:discussion范围才能使用此端点。

“删除团队讨论评论反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “团队讨论”组织权限(写入)

“删除团队讨论评论反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
org string 必需

组织名称。名称不区分大小写。

team_slug string 必需

团队名称的 slug。

discussion_number integer 必需

标识讨论的数字。

comment_number integer 必需

标识评论的数字。

reaction_id 整数 必需

反应的唯一标识符。

“删除团队讨论评论反应”的 HTTP 响应状态代码

状态代码说明
204

无内容

“删除团队讨论评论反应”的代码示例

请求示例

delete/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}
curl -L \ -X DELETE \ -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/teams/TEAM_SLUG/discussions/DISCUSSION_NUMBER/comments/COMMENT_NUMBER/reactions/REACTION_ID

响应

状态:204

列出团队讨论的反应

列出对 团队讨论 的反应。

注意:你还可以使用路由 GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions 通过 org_idteam_id 指定团队。

OAuth 应用令牌和个人访问令牌(经典)需要 read:discussion 范围才能使用此端点。

“列出团队讨论的反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
org string 必需

组织名称。名称不区分大小写。

team_slug string 必需

团队名称的 slug。

discussion_number integer 必需

标识讨论的数字。

查询参数
名称、类型、说明
content 字符串

返回单个 反应类型。省略此参数可列出对团队讨论的所有反应。

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

per_page 整数

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 30

page 整数

要获取的结果的页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 1

“列出团队讨论的反应”的 HTTP 响应状态代码

状态代码说明
200

OK

“列出团队讨论的反应”的代码示例

请求示例

get/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
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/teams/TEAM_SLUG/discussions/DISCUSSION_NUMBER/reactions

响应

状态:200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" } ]

为团队讨论创建反应

团队讨论创建反应。

HTTP 200 状态的响应表示您已将反应类型添加到此团队讨论中。

注意:您还可以使用路由 POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions 通过 org_idteam_id 指定团队。

OAuth 应用令牌和个人访问令牌(经典)需要write:discussion范围才能使用此端点。

“为团队讨论创建反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
org string 必需

组织名称。名称不区分大小写。

team_slug string 必需

团队名称的 slug。

discussion_number integer 必需

标识讨论的数字。

正文参数
名称、类型、说明
content string 必需

要添加到团队讨论中的反应类型

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

“为团队讨论创建反应”的 HTTP 响应状态代码

状态代码说明
200

OK

201

已创建

“为团队讨论创建反应”的代码示例

请求示例

post/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
curl -L \ -X POST \ -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/teams/TEAM_SLUG/discussions/DISCUSSION_NUMBER/reactions \ -d '{"content":"heart"}'

响应

状态:200
{ "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" }

删除团队讨论反应

注意:您还可以使用路由 DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id 通过 team_idorg_id 指定团队或组织。

删除对团队讨论的反应。

OAuth 应用令牌和个人访问令牌(经典)需要write:discussion范围才能使用此端点。

“删除团队讨论反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “团队讨论”组织权限(写入)

“删除团队讨论反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
org string 必需

组织名称。名称不区分大小写。

team_slug string 必需

团队名称的 slug。

discussion_number integer 必需

标识讨论的数字。

reaction_id 整数 必需

反应的唯一标识符。

“删除团队讨论反应”的 HTTP 响应状态代码

状态代码说明
204

无内容

“删除团队讨论反应”的代码示例

请求示例

delete/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}
curl -L \ -X DELETE \ -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/teams/TEAM_SLUG/discussions/DISCUSSION_NUMBER/reactions/REACTION_ID

响应

状态:204

列出对提交注释的反应

列出对提交注释的反应。

“列出提交评论的反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “元数据”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“列出提交评论的反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

comment_id integer 必需

评论的唯一标识符。

查询参数
名称、类型、说明
content 字符串

返回单个 反应类型。省略此参数以列出对提交评论的所有反应。

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

per_page 整数

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 30

page 整数

要获取的结果的页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 1

“列出提交评论的反应”的 HTTP 响应状态代码

状态代码说明
200

OK

404

未找到资源

“列出提交评论的反应”的代码示例

请求示例

get/repos/{owner}/{repo}/comments/{comment_id}/reactions
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/comments/COMMENT_ID/reactions

响应

状态:200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" } ]

为提交评论创建反应

提交评论 创建反应。HTTP 200 状态的响应表示您已将反应类型添加到此提交评论。

“为提交评论创建反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “内容”存储库权限(写入)

“为提交评论创建反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

comment_id integer 必需

评论的唯一标识符。

正文参数
名称、类型、说明
content string 必需

要添加到提交评论的 反应类型

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

“为提交评论创建反应”的 HTTP 响应状态代码

状态代码说明
200

反应已存在

201

已创建反应

422

验证失败,或端点已收到垃圾邮件。

“为提交评论创建反应”的代码示例

请求示例

post/repos/{owner}/{repo}/comments/{comment_id}/reactions
curl -L \ -X POST \ -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/comments/COMMENT_ID/reactions \ -d '{"content":"heart"}'

反应已存在

状态:200
{ "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" }

删除提交评论反应

注意:你还可以使用路由 DELETE /repositories/:repository_id/comments/:comment_id/reactions/:reaction_id 通过 repository_id 指定存储库。

删除对 提交评论 的反应。

“删除提交评论反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “内容”存储库权限(写入)

“删除提交评论反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

comment_id integer 必需

评论的唯一标识符。

reaction_id 整数 必需

反应的唯一标识符。

“删除提交评论反应”的 HTTP 响应状态代码

状态代码说明
204

无内容

“删除提交评论反应”的代码示例

请求示例

delete/repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}
curl -L \ -X DELETE \ -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/comments/COMMENT_ID/reactions/REACTION_ID

响应

状态:204

列出问题评论的反应

列出对 问题评论 的反应。

“列出问题评论的反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “问题”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“列出问题评论的反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

comment_id integer 必需

评论的唯一标识符。

查询参数
名称、类型、说明
content 字符串

返回单个 反应类型。省略此参数以列出对问题评论的所有反应。

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

per_page 整数

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 30

page 整数

要获取的结果的页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 1

“列出问题评论的反应”的 HTTP 响应状态代码

状态代码说明
200

OK

404

未找到资源

“列出问题评论的反应”的代码示例

请求示例

get/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
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/issues/comments/COMMENT_ID/reactions

响应

状态:200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" } ]

为问题评论创建反应

问题评论 创建反应。HTTP 200 状态的响应表示你已将反应类型添加到此问题评论。

“为问题评论创建反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “问题”存储库权限(写)

“为问题评论创建反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

comment_id integer 必需

评论的唯一标识符。

正文参数
名称、类型、说明
content string 必需

要添加到问题评论中的反应类型

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

“为问题评论创建反应”的 HTTP 响应状态代码

状态代码说明
200

反应已存在

201

已创建反应

422

验证失败,或端点已收到垃圾邮件。

“为问题评论创建反应”的代码示例

请求示例

post/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
curl -L \ -X POST \ -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/issues/comments/COMMENT_ID/reactions \ -d '{"content":"heart"}'

反应已存在

状态:200
{ "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" }

删除问题评论反应

注意:你还可以使用路由 DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id 通过 repository_id 指定存储库。

删除对问题评论的反应。

“删除问题评论反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “问题”存储库权限(写)

“删除问题评论反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

comment_id integer 必需

评论的唯一标识符。

reaction_id 整数 必需

反应的唯一标识符。

“删除问题评论反应”的 HTTP 响应状态代码

状态代码说明
204

无内容

“删除问题评论反应”的代码示例

请求示例

delete/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}
curl -L \ -X DELETE \ -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/issues/comments/COMMENT_ID/reactions/REACTION_ID

响应

状态:204

列出问题反应

列出对问题的反应。

“列出问题反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “问题”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“列出问题反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

issue_number 整数 必需

标识问题的编号。

查询参数
名称、类型、说明
content 字符串

返回单个反应类型。省略此参数以列出对问题的全部反应。

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

per_page 整数

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 30

page 整数

要获取的结果的页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 1

“列出问题反应”的 HTTP 响应状态代码

状态代码说明
200

OK

404

未找到资源

410

已删除

“列出问题反应”的代码示例

请求示例

获取/repos/{owner}/{repo}/issues/{issue_number}/reactions
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/issues/ISSUE_NUMBER/reactions

响应

状态:200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" } ]

为议题创建反应

议题 创建反应。HTTP 200 状态的响应表示您已将反应类型添加到此议题。

“为议题创建反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “问题”存储库权限(写)

“为议题创建反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

issue_number 整数 必需

标识问题的编号。

正文参数
名称、类型、说明
content string 必需

要添加到议题的 反应类型

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

“为议题创建反应”的 HTTP 响应状态代码

状态代码说明
200

OK

201

已创建

422

验证失败,或端点已收到垃圾邮件。

“为议题创建反应”的代码示例

请求示例

发布/repos/{owner}/{repo}/issues/{issue_number}/reactions
curl -L \ -X POST \ -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/issues/ISSUE_NUMBER/reactions \ -d '{"content":"heart"}'

响应

状态:200
{ "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" }

删除议题反应

注意:您还可以使用 repository_id 通过路由 DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id 指定存储库。

删除对 议题 的反应。

“删除议题反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “问题”存储库权限(写)

“删除议题反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

issue_number 整数 必需

标识问题的编号。

reaction_id 整数 必需

反应的唯一标识符。

“删除议题反应”的 HTTP 响应状态代码

状态代码说明
204

无内容

“删除议题反应”的代码示例

请求示例

删除/repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}
curl -L \ -X DELETE \ -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/issues/ISSUE_NUMBER/reactions/REACTION_ID

响应

状态:204

列出对 Pull Request 评论的反应

列出对 Pull Request 评论 的反应。

“列出对 Pull Request 评论的反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “Pull Request”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“列出对 Pull Request 评论的反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

comment_id integer 必需

评论的唯一标识符。

查询参数
名称、类型、说明
content 字符串

返回单个 反应类型。省略此参数以列出对 Pull Request 评论的所有反应。

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

per_page 整数

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 30

page 整数

要获取的结果的页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 1

“列出拉取请求审查评论的反应”的 HTTP 响应状态代码

状态代码说明
200

OK

404

未找到资源

“列出拉取请求审查评论的反应”的代码示例

请求示例

get/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
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/pulls/comments/COMMENT_ID/reactions

响应

状态:200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" } ]

为拉取请求审查评论创建反应

拉取请求审查评论创建反应。HTTP 200 状态的响应表示您已将反应类型添加到此拉取请求审查评论。

“为拉取请求审查评论创建反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “拉取请求”存储库权限(写入)

“为拉取请求审查评论创建反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

comment_id integer 必需

评论的唯一标识符。

正文参数
名称、类型、说明
content string 必需

反应类型,用于添加到拉取请求审查评论。

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

“为拉取请求审查评论创建反应”的 HTTP 响应状态代码

状态代码说明
200

反应已存在

201

已创建反应

422

验证失败,或端点已收到垃圾邮件。

“为拉取请求审查评论创建反应”的代码示例

请求示例

post/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
curl -L \ -X POST \ -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/pulls/comments/COMMENT_ID/reactions \ -d '{"content":"heart"}'

反应已存在

状态:200
{ "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" }

删除拉取请求评论反应

注意:您还可以使用路由 DELETE /repositories/:repository_id/pulls/comments/:comment_id/reactions/:reaction_id.repository_id 指定存储库。

删除对拉取请求审查评论的反应。

“删除拉取请求评论反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌必须具有以下权限集

  • “拉取请求”存储库权限(写入)

“删除拉取请求评论反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

comment_id integer 必需

评论的唯一标识符。

reaction_id 整数 必需

反应的唯一标识符。

“删除拉取请求评论反应”的 HTTP 响应状态代码

状态代码说明
204

无内容

“删除拉取请求评论反应”的代码示例

请求示例

删除/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}
curl -L \ -X DELETE \ -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/pulls/comments/COMMENT_ID/reactions/REACTION_ID

响应

状态:204

列出版本反应

列出对 版本 的反应。

“列出版本反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌不需要任何权限。

“列出版本反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

release_id 整数 必需

版本的唯一标识符。

查询参数
名称、类型、说明
content 字符串

返回单个 反应类型。省略此参数以列出对版本的所有反应。

可以是: +1, laugh, heart, hooray, rocket, eyes

per_page 整数

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 30

page 整数

要获取的结果的页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 1

“列出版本反应”的 HTTP 响应状态代码

状态代码说明
200

OK

404

未找到资源

“列出版本反应”的代码示例

请求示例

获取/repos/{owner}/{repo}/releases/{release_id}/reactions
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/releases/RELEASE_ID/reactions

响应

状态:200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" } ]

为版本创建反应

版本 创建反应。Status: 200 OK 的响应表示您已向此版本添加反应类型。

“为版本创建反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌不需要任何权限。

“为版本创建反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

release_id 整数 必需

版本的唯一标识符。

正文参数
名称、类型、说明
content string 必需

要添加到版本的 反应类型

可以是: +1, laugh, heart, hooray, rocket, eyes

“为版本创建反应”的 HTTP 响应状态代码

状态代码说明
200

反应已存在

201

已创建反应

422

验证失败,或端点已收到垃圾邮件。

“为版本创建反应”的代码示例

请求示例

发布/repos/{owner}/{repo}/releases/{release_id}/reactions
curl -L \ -X POST \ -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/releases/RELEASE_ID/reactions \ -d '{"content":"heart"}'

反应已存在

状态:200
{ "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" }

删除版本反应

注意:您还可以使用路由 DELETE delete /repositories/:repository_id/releases/:release_id/reactions/:reaction_id 通过 repository_id 指定存储库。

删除对 发行版 的反应。

“删除发行版反应”的细粒度访问令牌

此端点适用于以下细粒度令牌类型

细粒度令牌不需要任何权限。

“删除发行版反应”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

不带 .git 扩展名的存储库名称。名称不区分大小写。

release_id 整数 必需

版本的唯一标识符。

reaction_id 整数 必需

反应的唯一标识符。

“删除发行版反应”的 HTTP 响应状态代码

状态代码说明
204

无内容

“删除发行版反应”的代码示例

请求示例

delete/repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id}
curl -L \ -X DELETE \ -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/releases/RELEASE_ID/reactions/REACTION_ID

响应

状态:204

列出团队讨论评论的反应(旧版)

弃用通知:此端点路由已弃用,将从团队 API 中移除。我们建议将现有代码迁移到使用新的 列出团队讨论评论的反应 端点。

列出对 团队讨论评论 的反应。

OAuth 应用令牌和个人访问令牌(经典)需要 read:discussion 范围才能使用此端点。

“列出团队讨论评论的反应(旧版)”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
team_id 整数 必需

团队的唯一标识符。

discussion_number integer 必需

标识讨论的数字。

comment_number integer 必需

标识评论的数字。

查询参数
名称、类型、说明
content 字符串

返回单个 反应类型。省略此参数可列出团队讨论评论的所有反应。

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

per_page 整数

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 30

page 整数

要获取的结果的页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 1

“列出团队讨论评论的反应(旧版)”的 HTTP 响应状态代码

状态代码说明
200

OK

“列出团队讨论评论的反应(旧版)”的代码示例

请求示例

get/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
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/teams/TEAM_ID/discussions/DISCUSSION_NUMBER/comments/COMMENT_NUMBER/reactions

响应

状态:200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" } ]

为团队讨论评论创建反应(旧版)

弃用通知:此端点路由已弃用,将从团队 API 中移除。我们建议将现有代码迁移到使用新的 "为团队讨论评论创建反应" 端点。

团队讨论评论 创建反应。

HTTP 200 状态的响应表示你已将反应类型添加到此团队讨论评论。

OAuth 应用令牌和个人访问令牌(经典)需要write:discussion范围才能使用此端点。

“为团队讨论评论创建反应(旧版)”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
team_id 整数 必需

团队的唯一标识符。

discussion_number integer 必需

标识讨论的数字。

comment_number integer 必需

标识评论的数字。

正文参数
名称、类型、说明
content string 必需

要添加到团队讨论评论的反应类型

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

“为团队讨论评论创建反应(旧版)”的 HTTP 响应状态代码

状态代码说明
201

已创建

“为团队讨论评论创建反应(旧版)”的代码示例

请求示例

post/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/teams/TEAM_ID/discussions/DISCUSSION_NUMBER/comments/COMMENT_NUMBER/reactions \ -d '{"content":"heart"}'

响应

状态:201
{ "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" }

列出团队讨论的反应(旧版)

弃用通知:此端点路由已弃用,并将从 Teams API 中移除。我们建议将现有代码迁移到使用新的 列出团队讨论的反应 端点。

列出对 团队讨论 的反应。

OAuth 应用令牌和个人访问令牌(经典)需要 read:discussion 范围才能使用此端点。

“列出团队讨论的反应(旧版)”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
team_id 整数 必需

团队的唯一标识符。

discussion_number integer 必需

标识讨论的数字。

查询参数
名称、类型、说明
content 字符串

返回单个 反应类型。省略此参数可列出对团队讨论的所有反应。

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

per_page 整数

每页的结果数(最大 100)。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 30

page 整数

要获取的结果的页码。有关详细信息,请参阅“在 REST API 中使用分页”。

默认值: 1

“列出团队讨论的反应(旧版)”的 HTTP 响应状态代码

状态代码说明
200

OK

“列出团队讨论的反应(旧版)”的代码示例

请求示例

get/teams/{team_id}/discussions/{discussion_number}/reactions
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/teams/TEAM_ID/discussions/DISCUSSION_NUMBER/reactions

响应

状态:200
[ { "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" } ]

为团队讨论创建反应(旧版)

弃用通知:此端点路由已弃用,并将从 Teams API 中移除。我们建议将现有代码迁移到使用新的 为团队讨论创建反应 端点。

团队讨论创建反应。

HTTP 200 状态的响应表示您已将反应类型添加到此团队讨论中。

OAuth 应用令牌和个人访问令牌(经典)需要write:discussion范围才能使用此端点。

“为团队讨论创建反应(旧版)”的参数

标头
名称、类型、说明
accept string

建议设置为 application/vnd.github+json

路径参数
名称、类型、说明
team_id 整数 必需

团队的唯一标识符。

discussion_number integer 必需

标识讨论的数字。

正文参数
名称、类型、说明
content string 必需

要添加到团队讨论中的反应类型

可以是以下之一: +1, -1, laugh, confused, heart, hooray, rocket, eyes

“为团队讨论创建反应(旧版)”的 HTTP 响应状态代码

状态代码说明
201

已创建

“为团队讨论创建反应(旧版)”的代码示例

请求示例

post/teams/{team_id}/discussions/{discussion_number}/reactions
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/teams/TEAM_ID/discussions/DISCUSSION_NUMBER/reactions \ -d '{"content":"heart"}'

响应

状态:201
{ "id": 1, "node_id": "MDg6UmVhY3Rpb24x", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "content": "heart", "created_at": "2016-05-20T20:09:31Z" }