团队讨论的 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 string 建议设置为 |
名称、类型、说明 |
---|
org string 必需组织名称。名称不区分大小写。 |
team_slug string 必需团队名称的 slug。 |
名称、类型、说明 |
---|
direction string 按其对结果进行排序的方向。 默认: 可以是以下之一: |
per_page integer 每页的结果数(最大 100)。更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果的页码。更多信息,请参阅“在 REST API 中使用分页”。 默认: |
pinned string 仅筛选已固定的讨论 |
“列出讨论”的 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": "嗨!这是我们作为团队进行协作的区域。", "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 } } ]
创建讨论
在团队页面上创建新的讨论帖子。
此端点触发通知。使用此端点过快创建内容可能会导致次要速率限制。有关详细信息,请参阅“REST API 的速率限制”和“使用 REST API 的最佳实践”。
注意:您还可以使用路由 POST /organizations/{org_id}/team/{team_id}/discussions
通过 org_id
和 team_id
指定团队。
OAuth 应用令牌和个人访问令牌(经典版)需要 write:discussion
范围才能使用此端点。
“创建讨论”的参数
名称、类型、说明 |
---|
accept string 建议设置为 |
名称、类型、说明 |
---|
org string 必需组织名称。名称不区分大小写。 |
team_slug string 必需团队名称的 slug。 |
名称、类型、说明 |
---|
title string 必需讨论帖子的标题。 |
body string 必需讨论帖子的正文文本。 |
private boolean 私有帖子仅对团队成员、组织所有者和团队维护者可见。公开帖子对组织的所有成员可见。设置为 默认: |
“创建讨论”的 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": "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 } }
获取讨论
获取团队页面上的特定讨论。
注意:你还可以使用 org_id
和 team_id
通过路由 GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}
指定团队。
OAuth 应用令牌和个人访问令牌(经典)需要 read:discussion
范围才能使用此端点。
“获取讨论”的参数
名称、类型、说明 |
---|
accept string 建议设置为 |
名称、类型、说明 |
---|
org string 必需组织名称。名称不区分大小写。 |
team_slug string 必需团队名称的 slug。 |
discussion_number integer 必需用于标识讨论的数字。 |
“获取讨论”的 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": "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 } }
更新讨论
编辑讨论帖子的标题和正文文本。仅更新你提供的参数。
注意:你还可以使用路由 PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}
通过 org_id
和 team_id
指定团队。
OAuth 应用令牌和个人访问令牌(经典版)需要 write:discussion
范围才能使用此端点。
“更新讨论”的参数
名称、类型、说明 |
---|
accept string 建议设置为 |
名称、类型、说明 |
---|
org string 必需组织名称。名称不区分大小写。 |
team_slug string 必需团队名称的 slug。 |
discussion_number integer 必需用于标识讨论的数字。 |
名称、类型、说明 |
---|
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 string 建议设置为 |
名称、类型、说明 |
---|
org string 必需组织名称。名称不区分大小写。 |
team_slug string 必需团队名称的 slug。 |
discussion_number integer 必需用于标识讨论的数字。 |
“删除讨论”的 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 string 建议设置为 |
名称、类型、说明 |
---|
team_id 整数 必需团队的唯一标识符。 |
名称、类型、说明 |
---|
direction string 按其对结果进行排序的方向。 默认: 可以是以下之一: |
per_page integer 每页的结果数(最大 100)。更多信息,请参阅“在 REST API 中使用分页”。 默认: |
page integer 要获取的结果的页码。更多信息,请参阅“在 REST API 中使用分页”。 默认: |
“列出讨论(旧版)”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“列出讨论(旧版)”的代码示例
请求示例
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/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": "嗨!这是我们作为团队进行协作的区域。", "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 中删除。我们建议将现有代码迁移到使用新的 创建讨论
端点。
在团队页面上创建新的讨论帖子。
此端点触发通知。使用此端点过快创建内容可能会导致次要速率限制。有关详细信息,请参阅“REST API 的速率限制”和“使用 REST API 的最佳实践”。
OAuth 应用令牌和个人访问令牌(经典版)需要 write:discussion
范围才能使用此端点。
“创建讨论(旧版)”的参数
名称、类型、说明 |
---|
accept string 建议设置为 |
名称、类型、说明 |
---|
team_id 整数 必需团队的唯一标识符。 |
名称、类型、说明 |
---|
title string 必需讨论帖子的标题。 |
body string 必需讨论帖子的正文文本。 |
private boolean 私有帖子仅对团队成员、组织所有者和团队维护者可见。公开帖子对组织的所有成员可见。设置为 默认: |
“创建讨论(旧版)”的 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":"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": "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 } }
获取讨论(旧版)
弃用通知:此端点路由已弃用,并会从 Teams API 中移除。我们建议将现有代码迁移到使用新的 获取讨论 端点。
获取团队页面上的特定讨论。
OAuth 应用令牌和个人访问令牌(经典)需要 read:discussion
范围才能使用此端点。
“获取讨论(旧版)”的参数
名称、类型、说明 |
---|
accept string 建议设置为 |
名称、类型、说明 |
---|
team_id 整数 必需团队的唯一标识符。 |
discussion_number integer 必需用于标识讨论的数字。 |
“获取讨论(旧版)”的 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": "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 } }
更新讨论(旧版)
弃用通知:此端点路由已弃用,并会从 Teams API 中移除。我们建议将现有代码迁移到使用新的 更新讨论 端点。
编辑讨论帖子的标题和正文文本。仅更新你提供的参数。
OAuth 应用令牌和个人访问令牌(经典版)需要 write:discussion
范围才能使用此端点。
“更新讨论(旧版)”的参数
名称、类型、说明 |
---|
accept string 建议设置为 |
名称、类型、说明 |
---|
team_id 整数 必需团队的唯一标识符。 |
discussion_number integer 必需用于标识讨论的数字。 |
名称、类型、说明 |
---|
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 } }
删除讨论(旧版)
弃用通知:此端点路由已弃用,并会从 Teams API 中移除。我们建议将现有代码迁移到使用新的 删除讨论
端点。
从团队页面中删除讨论。
OAuth 应用令牌和个人访问令牌(经典版)需要 write:discussion
范围才能使用此端点。
“删除讨论(旧版)”的参数
名称、类型、说明 |
---|
accept string 建议设置为 |
名称、类型、说明 |
---|
team_id 整数 必需团队的唯一标识符。 |
discussion_number integer 必需用于标识讨论的数字。 |
“删除讨论(旧版)”的 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