我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

此版本的 GitHub Enterprise 已停止服务 2020-11-12. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

反应

本文内容

反应类型

创建反应时,content 参数的允许值如下(带有相应的表情符号供参考):

content表情符号
+1👍
-1👎
微笑😄
困惑😕
heart❤️
欢呼🎉
火箭🚀
眼睛👀

Delete a reaction

OAuth access tokens require the write:discussion scope, when deleting a team discussion or team discussion comment.

delete /reactions/{reaction_id}

参数

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. 查看预览通知

accept string header

This API is under preview and subject to change.

reaction_id integer path

代码示例

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/reactions/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /reactions/{reaction_id}', {
  reaction_id: 42
})

Default Response

Status: 204 No Content

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


get /repos/{owner}/{repo}/comments/{comment_id}/reactions

参数

Name Type In Description
accept string header

This API is under preview and subject to change. 查看预览通知

owner string path
repo string path
comment_id integer path

comment_id parameter

content string query

Returns a single reaction type. Omit this parameter to list all reactions to a commit comment.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
  https://api.github.com/repos/octocat/hello-world/comments/42/reactions
JavaScript (@octokit/core.js)
await octokit.request('GET /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
  owner: 'octocat',
  repo: 'hello-world',
  comment_id: 42,
  mediaType: {
    previews: [
      'squirrel-girl'
    ]
  }
})

Default response

Status: 200 OK
[
  {
    "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"
  }
]

Resource not found

Status: 404 Not Found

Preview header missing

Status: 415 Unsupported Media Type

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

☝️ 此标头必填.

Create reaction for a commit comment

Create a reaction to a commit comment. A response with a Status: 200 OK means that you already added the reaction type to this commit comment.

post /repos/{owner}/{repo}/comments/{comment_id}/reactions

参数

Name Type In Description
accept string header

This API is under preview and subject to change. 查看预览通知

owner string path
repo string path
comment_id integer path

comment_id parameter

content string body

Required. The reaction type to add to the commit comment.

代码示例

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
  https://api.github.com/repos/octocat/hello-world/comments/42/reactions \
  -d '{"content":"content"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
  owner: 'octocat',
  repo: 'hello-world',
  comment_id: 42,
  content: 'content',
  mediaType: {
    previews: [
      'squirrel-girl'
    ]
  }
})

Default response

Status: 200 OK
{
  "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"
}

Default response

Status: 201 Created
{
  "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"
}

Preview header missing

Status: 415 Unsupported Media Type

Validation failed

Status: 422 Unprocessable Entity

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

☝️ 此标头必填.

get /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions

参数

Name Type In Description
accept string header

This API is under preview and subject to change. 查看预览通知

owner string path
repo string path
comment_id integer path

comment_id parameter

content string query

Returns a single reaction type. Omit this parameter to list all reactions to an issue comment.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions
JavaScript (@octokit/core.js)
await octokit.request('GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
  owner: 'octocat',
  repo: 'hello-world',
  comment_id: 42,
  mediaType: {
    previews: [
      'squirrel-girl'
    ]
  }
})

Default response

Status: 200 OK
[
  {
    "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"
  }
]

Resource not found

Status: 404 Not Found

Preview header missing

Status: 415 Unsupported Media Type

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

☝️ 此标头必填.

Create reaction for an issue comment

Create a reaction to an issue comment. A response with a Status: 200 OK means that you already added the reaction type to this issue comment.

post /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions

参数

Name Type In Description
accept string header

This API is under preview and subject to change. 查看预览通知

owner string path
repo string path
comment_id integer path

comment_id parameter

content string body

Required. The reaction type to add to the issue comment.

代码示例

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions \
  -d '{"content":"content"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
  owner: 'octocat',
  repo: 'hello-world',
  comment_id: 42,
  content: 'content',
  mediaType: {
    previews: [
      'squirrel-girl'
    ]
  }
})

Default response

Status: 200 OK
{
  "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"
}

Default response

Status: 201 Created
{
  "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"
}

Preview header missing

Status: 415 Unsupported Media Type

Validation failed

Status: 422 Unprocessable Entity

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

☝️ 此标头必填.

List reactions for an issue

List the reactions to an issue.

get /repos/{owner}/{repo}/issues/{issue_number}/reactions

参数

Name Type In Description
accept string header

This API is under preview and subject to change. 查看预览通知

owner string path
repo string path
issue_number integer path

issue_number parameter

content string query

Returns a single reaction type. Omit this parameter to list all reactions to an issue.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
  https://api.github.com/repos/octocat/hello-world/issues/42/reactions
JavaScript (@octokit/core.js)
await octokit.request('GET /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
  owner: 'octocat',
  repo: 'hello-world',
  issue_number: 42,
  mediaType: {
    previews: [
      'squirrel-girl'
    ]
  }
})

Default response

Status: 200 OK
[
  {
    "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"
  }
]

Resource not found

Status: 404 Not Found

Gone

Status: 410 Gone

Preview header missing

Status: 415 Unsupported Media Type

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

☝️ 此标头必填.

Create reaction for an issue

Create a reaction to an issue. A response with a Status: 200 OK means that you already added the reaction type to this issue.

post /repos/{owner}/{repo}/issues/{issue_number}/reactions

参数

Name Type In Description
accept string header

This API is under preview and subject to change. 查看预览通知

owner string path
repo string path
issue_number integer path

issue_number parameter

content string body

Required. The reaction type to add to the issue.

代码示例

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
  https://api.github.com/repos/octocat/hello-world/issues/42/reactions \
  -d '{"content":"content"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
  owner: 'octocat',
  repo: 'hello-world',
  issue_number: 42,
  content: 'content',
  mediaType: {
    previews: [
      'squirrel-girl'
    ]
  }
})

Default response

Status: 201 Created
{
  "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"
}

Preview header missing

Status: 415 Unsupported Media Type

Validation failed

Status: 422 Unprocessable Entity

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

☝️ 此标头必填.

get /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions

参数

Name Type In Description
accept string header

This API is under preview and subject to change. 查看预览通知

owner string path
repo string path
comment_id integer path

comment_id parameter

content string query

Returns a single reaction type. Omit this parameter to list all reactions to a pull request review comment.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions
JavaScript (@octokit/core.js)
await octokit.request('GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
  owner: 'octocat',
  repo: 'hello-world',
  comment_id: 42,
  mediaType: {
    previews: [
      'squirrel-girl'
    ]
  }
})

Default response

Status: 200 OK
[
  {
    "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"
  }
]

Resource not found

Status: 404 Not Found

Preview header missing

Status: 415 Unsupported Media Type

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

☝️ 此标头必填.

Create reaction for a pull request review comment

Create a reaction to a pull request review comment. A response with a Status: 200 OK means that you already added the reaction type to this pull request review comment.

post /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions

参数

Name Type In Description
accept string header

This API is under preview and subject to change. 查看预览通知

owner string path
repo string path
comment_id integer path

comment_id parameter

content string body

Required. The reaction type to add to the pull request review comment.

代码示例

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions \
  -d '{"content":"content"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
  owner: 'octocat',
  repo: 'hello-world',
  comment_id: 42,
  content: 'content',
  mediaType: {
    previews: [
      'squirrel-girl'
    ]
  }
})

Default response

Status: 200 OK
{
  "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"
}

Default response

Status: 201 Created
{
  "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"
}

Preview header missing

Status: 415 Unsupported Media Type

Validation failed

Status: 422 Unprocessable Entity

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.

☝️ 此标头必填.

List reactions for a team discussion comment

List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.

get /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions

参数

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. 查看预览通知

accept string header

This API is under preview and subject to change.

team_id integer path
discussion_number integer path
comment_number integer path
content string query

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42/comments/42/reactions
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
  team_id: 42,
  discussion_number: 42,
  comment_number: 42
})

Default response

Status: 200 OK
[
  {
    "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"
  }
]

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Create reaction for a team discussion comment

Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.

post /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions

参数

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. 查看预览通知

accept string header

This API is under preview and subject to change.

team_id integer path
discussion_number integer path
comment_number integer path
content string body

Required. The reaction type to add to the team discussion comment.

代码示例

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42/comments/42/reactions \
  -d '{"content":"content"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
  team_id: 42,
  discussion_number: 42,
  comment_number: 42,
  content: 'content'
})

Default response

Status: 201 Created
{
  "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"
}

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


List reactions for a team discussion

List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.

get /teams/{team_id}/discussions/{discussion_number}/reactions

参数

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. 查看预览通知

accept string header

This API is under preview and subject to change.

team_id integer path
discussion_number integer path
content string query

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42/reactions
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/reactions', {
  team_id: 42,
  discussion_number: 42
})

Default response

Status: 200 OK
[
  {
    "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"
  }
]

Notes

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Create reaction for a team discussion

Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.

post /teams/{team_id}/discussions/{discussion_number}/reactions

参数

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. 查看预览通知

accept string header

This API is under preview and subject to change.

team_id integer path
discussion_number integer path
content string body

Required. The reaction type to add to the team discussion.

代码示例

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42/reactions \
  -d '{"content":"content"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/reactions', {
  team_id: 42,
  discussion_number: 42,
  content: 'content'
})

Default response

Status: 201 Created
{
  "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"
}

预览通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.