团队讨论的 REST API 端点
使用 REST API 获取、创建、编辑和删除团队页面上的讨论帖子。
团队讨论和团队讨论评论端点将于 2023 年 11 月 28 日停止使用,转而使用 GitHub 讨论。有关 GitHub 讨论的更多信息,请参阅“GitHub 讨论文档”。
列出讨论
列出团队页面上的所有讨论。
注意
您还可以使用路由GET /organizations/{org_id}/team/{team_id}/discussions
通过org_id
和team_id
指定团队。
OAuth 应用令牌和个人访问令牌(经典版)需要read:discussion
作用域才能使用此端点。
"列出讨论"的参数
名称,类型,描述 |
---|
accept 字符串建议设置为 |
名称,类型,描述 |
---|
org 字符串 必需组织名称。名称不区分大小写。 |
team_slug 字符串 必需团队名称的slug。 |
名称,类型,描述 |
---|
direction 字符串排序结果的方向。 默认值: 可以是: |
per_page 整数每页结果数(最大 100)。更多信息,请参阅“REST API 中使用分页”。 默认值: |
page 整数要获取的结果页码。更多信息,请参阅“REST API 中使用分页”。 默认值: |
pinned 字符串仅限已固定讨论的筛选器 |
"列出讨论"的 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/teams/TEAM_SLUG/discussions
响应
状态: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": "Hi! This is an area for us to collaborate as a team.", "body_html": "<p>Hi! This is an area for us to collaborate as a team</p>", "body_version": "0d495416a700fb06133c612575d92bfb", "comments_count": 0, "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments", "created_at": "2018-01-25T18:56:31Z", "last_edited_at": null, "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1", "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==", "number": 1, "pinned": false, "private": false, "team_url": "https://api.github.com/teams/2343027", "title": "Our first team post", "updated_at": "2018-01-25T18:56:31Z", "url": "https://api.github.com/teams/2343027/discussions/1", "reactions": { "url": "https://api.github.com/teams/2343027/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
通过org_id
和team_id
指定团队。
OAuth 应用令牌和个人访问令牌(经典版)需要write:discussion
作用域才能使用此端点。
"创建讨论"的参数
名称,类型,描述 |
---|
accept 字符串建议设置为 |
名称,类型,描述 |
---|
org 字符串 必需组织名称。名称不区分大小写。 |
team_slug 字符串 必需团队名称的slug。 |
名称,类型,描述 |
---|
title 字符串 必需讨论帖子的标题。 |
body 字符串 必需讨论帖子的正文文本。 |
private 布尔值私有帖子仅对团队成员、组织所有者和团队维护者可见。公开帖子对组织的所有成员可见。设置为 默认值: |
"创建讨论"的 HTTP 响应状态码
状态码 | 描述 |
---|---|
201 | 已创建 |
"创建讨论"的代码示例
请求示例
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 \ -d '{"title":"Our first team post","body":"Hi! This is an area for us to collaborate as a team."}'
响应
状态: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": "嗨!这是一个团队协作的区域。", "body_html": "<p>嗨!这是一个团队协作的区域</p>", "body_version": "0d495416a700fb06133c612575d92bfb", "comments_count": 0, "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments", "created_at": "2018-01-25T18:56:31Z", "last_edited_at": null, "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1", "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==", "number": 1, "pinned": false, "private": false, "team_url": "https://api.github.com/teams/2343027", "title": "我们的第一个团队帖子", "updated_at": "2018-01-25T18:56:31Z", "url": "https://api.github.com/teams/2343027/discussions/1", "reactions": { "url": "https://api.github.com/teams/2343027/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}
通过org_id
和team_id
指定团队。
OAuth 应用令牌和个人访问令牌(经典版)需要read:discussion
作用域才能使用此端点。
"获取讨论"的参数
名称,类型,描述 |
---|
accept 字符串建议设置为 |
名称,类型,描述 |
---|
org 字符串 必需组织名称。名称不区分大小写。 |
team_slug 字符串 必需团队名称的slug。 |
discussion_number 整数 必填标识讨论的编号。 |
"获取讨论"的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/teams/TEAM_SLUG/discussions/DISCUSSION_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": "嗨!这是一个团队协作的区域。", "body_html": "<p>嗨!这是一个团队协作的区域</p>", "body_version": "0d495416a700fb06133c612575d92bfb", "comments_count": 0, "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments", "created_at": "2018-01-25T18:56:31Z", "last_edited_at": null, "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1", "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==", "number": 1, "pinned": false, "private": false, "team_url": "https://api.github.com/teams/2343027", "title": "我们的第一个团队帖子", "updated_at": "2018-01-25T18:56:31Z", "url": "https://api.github.com/teams/2343027/discussions/1", "reactions": { "url": "https://api.github.com/teams/2343027/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}
通过org_id
和team_id
指定团队。
OAuth 应用令牌和个人访问令牌(经典版)需要write:discussion
作用域才能使用此端点。
"更新讨论"的参数
名称,类型,描述 |
---|
accept 字符串建议设置为 |
名称,类型,描述 |
---|
org 字符串 必需组织名称。名称不区分大小写。 |
team_slug 字符串 必需团队名称的slug。 |
discussion_number 整数 必填标识讨论的编号。 |
名称,类型,描述 |
---|
title 字符串讨论帖子的标题。 |
body 字符串讨论帖子的正文文本。 |
"更新讨论"的HTTP响应状态码
状态码 | 描述 |
---|---|
200 | OK |
"更新讨论"的代码示例
请求示例
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 \ -d '{"title":"欢迎来到我们的第一个团队帖子"}'
响应
状态: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": "0d495416a700fb06133c612575d92bfb", "comments_count": 1, "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments", "created_at": "2018-01-25T18:56:31Z", "last_edited_at": "2018-01-26T18:22:20Z", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1", "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==", "number": 1, "pinned": false, "private": false, "team_url": "https://api.github.com/teams/2343027", "title": "欢迎来到我们的第一个团队帖子", "updated_at": "2018-01-26T18:22:20Z", "url": "https://api.github.com/teams/2343027/discussions/1", "reactions": { "url": "https://api.github.com/teams/2343027/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}
通过org_id
和team_id
指定团队。
OAuth 应用令牌和个人访问令牌(经典版)需要write:discussion
作用域才能使用此端点。
"删除讨论"的参数
名称,类型,描述 |
---|
accept 字符串建议设置为 |
名称,类型,描述 |
---|
org 字符串 必需组织名称。名称不区分大小写。 |
team_slug 字符串 必需团队名称的slug。 |
discussion_number 整数 必填标识讨论的编号。 |
"删除讨论"的HTTP响应状态码
状态码 | 描述 |
---|---|
204 | 无内容 |
"删除讨论"的代码示例
请求示例
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
响应
状态:204
列出讨论(旧版)
警告
端点关闭通知:此端点路由即将关闭,并将从团队API中移除。我们建议您将现有代码迁移到新的列出讨论
端点。
列出团队页面上的所有讨论。
OAuth 应用令牌和个人访问令牌(经典版)需要read:discussion
作用域才能使用此端点。
"列出讨论(旧版)"的参数
名称,类型,描述 |
---|
accept 字符串建议设置为 |
名称,类型,描述 |
---|
team_id 整数 必填团队的唯一标识符。 |
名称,类型,描述 |
---|
direction 字符串排序结果的方向。 默认值: 可以是: |
per_page 整数每页结果数(最大 100)。更多信息,请参阅“REST API 中使用分页”。 默认值: |
page 整数要获取的结果页码。更多信息,请参阅“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/teams/TEAM_ID/discussions
响应
状态: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": "Hi! This is an area for us to collaborate as a team.", "body_html": "<p>Hi! This is an area for us to collaborate as a team</p>", "body_version": "0d495416a700fb06133c612575d92bfb", "comments_count": 0, "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments", "created_at": "2018-01-25T18:56:31Z", "last_edited_at": null, "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1", "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==", "number": 1, "pinned": false, "private": false, "team_url": "https://api.github.com/teams/2343027", "title": "Our first team post", "updated_at": "2018-01-25T18:56:31Z", "url": "https://api.github.com/teams/2343027/discussions/1", "reactions": { "url": "https://api.github.com/teams/2343027/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 字符串建议设置为 |
名称,类型,描述 |
---|
team_id 整数 必填团队的唯一标识符。 |
名称,类型,描述 |
---|
title 字符串 必需讨论帖子的标题。 |
body 字符串 必需讨论帖子的正文文本。 |
private 布尔值私有帖子仅对团队成员、组织所有者和团队维护者可见。公开帖子对组织的所有成员可见。设置为 默认值: |
"创建讨论(旧版)"的HTTP响应状态码
状态码 | 描述 |
---|---|
201 | 已创建 |
"创建讨论(旧版)"的代码示例
请求示例
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 \ -d '{"title":"我们的第一个团队帖子","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": "嗨!这是一个团队协作的区域。", "body_html": "<p>嗨!这是一个团队协作的区域</p>", "body_version": "0d495416a700fb06133c612575d92bfb", "comments_count": 0, "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments", "created_at": "2018-01-25T18:56:31Z", "last_edited_at": null, "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1", "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==", "number": 1, "pinned": false, "private": false, "team_url": "https://api.github.com/teams/2343027", "title": "我们的第一个团队帖子", "updated_at": "2018-01-25T18:56:31Z", "url": "https://api.github.com/teams/2343027/discussions/1", "reactions": { "url": "https://api.github.com/teams/2343027/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 字符串建议设置为 |
名称,类型,描述 |
---|
team_id 整数 必填团队的唯一标识符。 |
discussion_number 整数 必填标识讨论的编号。 |
"获取讨论(旧版)"的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/teams/TEAM_ID/discussions/DISCUSSION_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": "嗨!这是一个团队协作的区域。", "body_html": "<p>嗨!这是一个团队协作的区域</p>", "body_version": "0d495416a700fb06133c612575d92bfb", "comments_count": 0, "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments", "created_at": "2018-01-25T18:56:31Z", "last_edited_at": null, "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1", "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==", "number": 1, "pinned": false, "private": false, "team_url": "https://api.github.com/teams/2343027", "title": "我们的第一个团队帖子", "updated_at": "2018-01-25T18:56:31Z", "url": "https://api.github.com/teams/2343027/discussions/1", "reactions": { "url": "https://api.github.com/teams/2343027/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 字符串建议设置为 |
名称,类型,描述 |
---|
team_id 整数 必填团队的唯一标识符。 |
discussion_number 整数 必填标识讨论的编号。 |
名称,类型,描述 |
---|
title 字符串讨论帖子的标题。 |
body 字符串讨论帖子的正文文本。 |
"更新讨论(旧版)"的HTTP响应状态码
状态码 | 描述 |
---|---|
200 | OK |
"更新讨论(旧版)"的代码示例
请求示例
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 \ -d '{"title":"欢迎来到我们的第一个团队帖子"}'
响应
状态: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": "0d495416a700fb06133c612575d92bfb", "comments_count": 1, "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments", "created_at": "2018-01-25T18:56:31Z", "last_edited_at": "2018-01-26T18:22:20Z", "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1", "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==", "number": 1, "pinned": false, "private": false, "team_url": "https://api.github.com/teams/2343027", "title": "欢迎来到我们的第一个团队帖子", "updated_at": "2018-01-26T18:22:20Z", "url": "https://api.github.com/teams/2343027/discussions/1", "reactions": { "url": "https://api.github.com/teams/2343027/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 字符串建议设置为 |
名称,类型,描述 |
---|
team_id 整数 必填团队的唯一标识符。 |
discussion_number 整数 必填标识讨论的编号。 |
"删除讨论(旧版)"的HTTP响应状态码
状态码 | 描述 |
---|---|
204 | 无内容 |
"删除讨论(旧版)"的代码示例
请求示例
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
响应
状态:204