跳至主要内容
REST API 现在已版本化。 有关更多信息,请参阅 "关于 API 版本控制."

团队讨论评论的 REST API 端点

使用 REST API 获取、创建、编辑和删除 团队讨论 帖子上的讨论评论。

团队讨论和团队讨论评论端点将于 2023 年 11 月 28 日弃用,转而使用 GitHub Discussions。有关 GitHub Discussions 的更多信息,请参阅 "GitHub Discussions 文档."

列出讨论评论

列出团队讨论中的所有评论。

注意:您也可以使用路由 GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments 通过 org_idteam_id 指定团队。

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

"列出讨论评论" 的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
org string 必需

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

team_slug string 必需

团队名称的标识符。

discussion_number integer 必需

标识讨论的数字。

查询参数
名称、类型、描述
direction string

排序结果的方向。

默认: desc

可以是以下之一: asc, desc

per_page 整数

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

默认: 30

page 整数

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

默认: 1

“列出讨论评论”的 HTTP 响应状态码

状态码描述
200

OK

“列出讨论评论”的代码示例

请求示例

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

响应

状态:200
[ { "author": { "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 }, "body": "Do you like apples?", "body_html": "<p>Do you like apples?</p>", "body_version": "5eb32b219cdc6a5a9b29ba5d6caa9c51", "created_at": "2018-01-15T23:53:58Z", "last_edited_at": null, "discussion_url": "https://api.github.com/teams/2403582/discussions/1", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1", "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=", "number": 1, "updated_at": "2018-01-15T23:53:58Z", "url": "https://api.github.com/teams/2403582/discussions/1/comments/1", "reactions": { "url": "https://api.github.com/teams/2403582/discussions/1/reactions", "total_count": 5, "+1": 3, "-1": 1, "laugh": 0, "confused": 0, "heart": 1, "hooray": 0, "eyes": 1, "rocket": 1 } } ]

创建讨论评论

在团队讨论中创建新评论。

此端点会触发 通知。使用此端点过快创建内容可能会导致二级速率限制。有关更多信息,请参阅“API 速率限制”和“使用 REST API 的最佳实践”。

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

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

“创建讨论评论”的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
org string 必需

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

team_slug string 必需

团队名称的标识符。

discussion_number integer 必需

标识讨论的数字。

主体参数
名称、类型、描述
body string 必需

讨论评论的正文文本。

“创建讨论评论”的 HTTP 响应状态代码

状态码描述
201

已创建

“创建讨论评论”的代码示例

请求示例

post/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments
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 \ -d '{"body":"你喜欢苹果吗?"}'

响应

状态:201
{ "author": { "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 }, "body": "Do you like apples?", "body_html": "<p>Do you like apples?</p>", "body_version": "5eb32b219cdc6a5a9b29ba5d6caa9c51", "created_at": "2018-01-15T23:53:58Z", "last_edited_at": null, "discussion_url": "https://api.github.com/teams/2403582/discussions/1", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1", "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=", "number": 1, "updated_at": "2018-01-15T23:53:58Z", "url": "https://api.github.com/teams/2403582/discussions/1/comments/1", "reactions": { "url": "https://api.github.com/teams/2403582/discussions/1/reactions", "total_count": 5, "+1": 3, "-1": 1, "laugh": 0, "confused": 0, "heart": 1, "hooray": 0, "eyes": 1, "rocket": 1 } }

获取讨论评论

获取团队讨论中的特定评论。

注意: 您也可以使用路线 GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number} 通过 org_idteam_id 指定团队。

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

“获取讨论评论”的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
org string 必需

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

team_slug string 必需

团队名称的标识符。

discussion_number integer 必需

标识讨论的数字。

comment_number 整数 必需

标识评论的编号。

“获取讨论评论”的 HTTP 响应状态码

状态码描述
200

OK

“获取讨论评论”的代码示例

请求示例

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

响应

状态:200
{ "author": { "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 }, "body": "Do you like apples?", "body_html": "<p>Do you like apples?</p>", "body_version": "5eb32b219cdc6a5a9b29ba5d6caa9c51", "created_at": "2018-01-15T23:53:58Z", "last_edited_at": null, "discussion_url": "https://api.github.com/teams/2403582/discussions/1", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1", "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=", "number": 1, "updated_at": "2018-01-15T23:53:58Z", "url": "https://api.github.com/teams/2403582/discussions/1/comments/1", "reactions": { "url": "https://api.github.com/teams/2403582/discussions/1/reactions", "total_count": 5, "+1": 3, "-1": 1, "laugh": 0, "confused": 0, "heart": 1, "hooray": 0, "eyes": 1, "rocket": 1 } }

更新讨论评论

编辑讨论评论的正文文本。

注意: 您也可以使用路线 PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number} 通过 org_idteam_id 指定团队。

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

“更新讨论评论”的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
org string 必需

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

team_slug string 必需

团队名称的标识符。

discussion_number integer 必需

标识讨论的数字。

comment_number 整数 必需

标识评论的编号。

主体参数
名称、类型、描述
body string 必需

讨论评论的正文文本。

“更新讨论评论”的 HTTP 响应状态码

状态码描述
200

OK

更新讨论评论的代码示例

请求示例

补丁/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}
curl -L \ -X PATCH \ -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 \ -d '{"body":"你喜欢菠萝吗?"}'

响应

状态:200
{ "author": { "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 }, "body": "你喜欢菠萝吗?", "body_html": "<p>你喜欢菠萝吗?</p>", "body_version": "e6907b24d9c93cc0c5024a7af5888116", "created_at": "2018-01-15T23:53:58Z", "last_edited_at": "2018-01-26T18:22:20Z", "discussion_url": "https://api.github.com/teams/2403582/discussions/1", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1", "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=", "number": 1, "updated_at": "2018-01-26T18:22:20Z", "url": "https://api.github.com/teams/2403582/discussions/1/comments/1", "reactions": { "url": "https://api.github.com/teams/2403582/discussions/1/reactions", "total_count": 5, "+1": 3, "-1": 1, "laugh": 0, "confused": 0, "heart": 1, "hooray": 0, "eyes": 1, "rocket": 1 } }

删除讨论评论

删除团队讨论中的评论。

注意:您也可以使用路由DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}通过org_idteam_id指定团队。

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

“删除讨论评论”的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
org string 必需

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

team_slug string 必需

团队名称的标识符。

discussion_number integer 必需

标识讨论的数字。

comment_number 整数 必需

标识评论的编号。

“删除讨论评论”的 HTTP 响应状态码

状态码描述
204

无内容

“删除讨论评论”的代码示例

请求示例

删除/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}
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

响应

状态:204

列出讨论评论(旧版)

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

列出团队讨论中的所有评论。

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

“列出讨论评论(旧版)”的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
team_id 整数 必需

团队的唯一标识符。

discussion_number integer 必需

标识讨论的数字。

查询参数
名称、类型、描述
direction string

排序结果的方向。

默认: desc

可以是以下之一: asc, desc

per_page 整数

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

默认: 30

page 整数

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

默认: 1

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

状态码描述
200

OK

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

请求示例

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

响应

状态:200
[ { "author": { "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 }, "body": "Do you like apples?", "body_html": "<p>Do you like apples?</p>", "body_version": "5eb32b219cdc6a5a9b29ba5d6caa9c51", "created_at": "2018-01-15T23:53:58Z", "last_edited_at": null, "discussion_url": "https://api.github.com/teams/2403582/discussions/1", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1", "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=", "number": 1, "updated_at": "2018-01-15T23:53:58Z", "url": "https://api.github.com/teams/2403582/discussions/1/comments/1", "reactions": { "url": "https://api.github.com/teams/2403582/discussions/1/reactions", "total_count": 5, "+1": 3, "-1": 1, "laugh": 0, "confused": 0, "heart": 1, "hooray": 0, "eyes": 1, "rocket": 1 } } ]

创建讨论评论(旧版)

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

在团队讨论中创建新评论。

此端点会触发 通知。使用此端点过快创建内容可能会导致二级速率限制。有关更多信息,请参阅“API 速率限制”和“使用 REST API 的最佳实践”。

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

“创建讨论评论(旧版)”的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
team_id 整数 必需

团队的唯一标识符。

discussion_number integer 必需

标识讨论的数字。

主体参数
名称、类型、描述
body string 必需

讨论评论的正文文本。

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

状态码描述
201

已创建

“创建讨论评论(旧版)”的代码示例

请求示例

post/teams/{team_id}/discussions/{discussion_number}/comments
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 \ -d '{"body":"Do you like apples?"}'

响应

状态:201
{ "author": { "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 }, "body": "Do you like apples?", "body_html": "<p>Do you like apples?</p>", "body_version": "5eb32b219cdc6a5a9b29ba5d6caa9c51", "created_at": "2018-01-15T23:53:58Z", "last_edited_at": null, "discussion_url": "https://api.github.com/teams/2403582/discussions/1", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1", "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=", "number": 1, "updated_at": "2018-01-15T23:53:58Z", "url": "https://api.github.com/teams/2403582/discussions/1/comments/1", "reactions": { "url": "https://api.github.com/teams/2403582/discussions/1/reactions", "total_count": 5, "+1": 3, "-1": 1, "laugh": 0, "confused": 0, "heart": 1, "hooray": 0, "eyes": 1, "rocket": 1 } }

获取讨论评论(旧版)

弃用通知:此端点路由已弃用,并将从团队 API 中删除。我们建议您将现有代码迁移到新的 获取讨论评论 端点。

获取团队讨论中的特定评论。

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

“获取讨论评论(旧版)”的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
team_id 整数 必需

团队的唯一标识符。

discussion_number integer 必需

标识讨论的数字。

comment_number 整数 必需

标识评论的编号。

“获取讨论评论(旧版)”的 HTTP 响应状态代码

状态码描述
200

OK

“获取讨论评论(旧版)”的代码示例

请求示例

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

响应

状态:200
{ "author": { "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 }, "body": "Do you like apples?", "body_html": "<p>Do you like apples?</p>", "body_version": "5eb32b219cdc6a5a9b29ba5d6caa9c51", "created_at": "2018-01-15T23:53:58Z", "last_edited_at": null, "discussion_url": "https://api.github.com/teams/2403582/discussions/1", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1", "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=", "number": 1, "updated_at": "2018-01-15T23:53:58Z", "url": "https://api.github.com/teams/2403582/discussions/1/comments/1", "reactions": { "url": "https://api.github.com/teams/2403582/discussions/1/reactions", "total_count": 5, "+1": 3, "-1": 1, "laugh": 0, "confused": 0, "heart": 1, "hooray": 0, "eyes": 1, "rocket": 1 } }

更新讨论评论(旧版)

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

编辑讨论评论的正文文本。

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

“更新讨论评论(旧版)”的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
team_id 整数 必需

团队的唯一标识符。

discussion_number integer 必需

标识讨论的数字。

comment_number 整数 必需

标识评论的编号。

主体参数
名称、类型、描述
body string 必需

讨论评论的正文文本。

“更新讨论评论(旧版)”的 HTTP 响应状态码

状态码描述
200

OK

“更新讨论评论(旧版)”的代码示例

请求示例

patch/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}
curl -L \ -X PATCH \ -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 \ -d '{"body":"Do you like pineapples?"}'

响应

状态:200
{ "author": { "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 }, "body": "你喜欢菠萝吗?", "body_html": "<p>你喜欢菠萝吗?</p>", "body_version": "e6907b24d9c93cc0c5024a7af5888116", "created_at": "2018-01-15T23:53:58Z", "last_edited_at": "2018-01-26T18:22:20Z", "discussion_url": "https://api.github.com/teams/2403582/discussions/1", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1", "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=", "number": 1, "updated_at": "2018-01-26T18:22:20Z", "url": "https://api.github.com/teams/2403582/discussions/1/comments/1", "reactions": { "url": "https://api.github.com/teams/2403582/discussions/1/reactions", "total_count": 5, "+1": 3, "-1": 1, "laugh": 0, "confused": 0, "heart": 1, "hooray": 0, "eyes": 1, "rocket": 1 } }

删除讨论评论(旧版)

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

删除团队讨论中的评论。

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

“删除讨论评论(旧版)”的参数

标头
名称、类型、描述
accept string

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

路径参数
名称、类型、描述
team_id 整数 必需

团队的唯一标识符。

discussion_number integer 必需

标识讨论的数字。

comment_number 整数 必需

标识评论的编号。

“删除讨论评论(旧版)”的 HTTP 响应状态码

状态码描述
204

无内容

“删除讨论评论(旧版)”的代码示例

请求示例

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

响应

状态:204