使用Github api获取Reactions

时间:2016-04-15 07:55:35

标签: github github-api

Github问题可能包含"反应"很长一段时间(如下所述:Fiddle example.

https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments

我想使用Github api接收这些信息,但在遇到问题时似乎没有这样的信息,例如。

api.github.com/repos/twbs/bootstrap/issues/19575

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

1 个答案:

答案 0 :(得分:3)

现在可以进行预览状态(意思是,您必须在请求中传递自定义Accept标头)。查看GitHub API documentation page

实施例

$ 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"
  }
]

端点如下所示:

GET /repos/:owner/:repo/issues/:number/reactions

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