使用 Github api 获取反应

Ole*_*ers 3 github github-api

Github 问题可能包含一段时间的“反应”(如此处所述:https : //github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments

在此处输入图片说明

我想使用 Github api 接收该信息,但在遇到问题时似乎没有类似的东西,例如

api.github.com/repos/twbs/bootstrap/issues/19575
Run Code Online (Sandbox Code Playgroud)

该信息似乎不在该响应中。此外,我没有找到可以检索该信息的另一个 API 调用。如何得到这些“反应”?

Ion*_*zău 7

现在这是可能的,处于预览状态(意味着,您必须Accept在请求中传递自定义标头)。查看GitHub API 文档页面

例子

$ curl -H 'Accept: application/vnd.github.squirrel-girl-preview' https://api.github.com/repos/twbs/bootstrap/issues/19575/reactions
[
  {
    "id": 257024,
    "user_id": 947110,
    "content": "+1"
  },
  ...
  {
    "id": 888868,
    "user_id": 1889800,
    "content": "+1"
  }
]
Run Code Online (Sandbox Code Playgroud)

端点如下所示:

GET /repos/:owner/:repo/issues/:number/reactions
Run Code Online (Sandbox Code Playgroud)

您甚至可以传递一个content参数(查询字符串),指示您想要检索的反应类型。