curl - 从 GitHub 拉取请求中获取评论列表

标签 curl github github-api

根据 http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request

我应该能够通过发出以下 curl 语句来获得评论列表,但是,它返回空,好像没有评论,有什么想法为什么?或者我怎样才能让它发挥作用?

curl "https://api.github.com/repos/37signals/sub/pulls/37/comments" -v

谢谢!

最佳答案

注意 Pull requests API docs 顶部附近的文本(根据TOC):

The Pull Request API allows you to list, view, edit, create, and even merge pull requests. Comments on pull requests can be managed via the Issue Comments API.



因此,API 端点 you are currently using用于拉取请求审查评论,而不是普通的拉取请求评论:

Pull Request Review Comments are comments on a portion of the unified diff. These are separate from Commit Comments (which are applied directly to a commit, outside of the Pull Request view), and Issue Comments (which do not reference a portion of the unified diff).



由于您引用的拉取请求没有任何审查意见,您将获得正确的结果(一个空列表)。但是,正如我上面提到的,您应该点击的 API 端点是问题评论的端点(只需使用相同的拉取请求 ID,因为它等于问题 ID):
curl "https://api.github.com/repos/37signals/sub/issues/37/comments" -v

关于curl - 从 GitHub 拉取请求中获取评论列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16198351/

相关文章:

c - 如何在 C 中使用 libcurl 获取 HTML 页面源代码

php - Preg_match_all 没有停在它应该在的地方

GitHub 操作 : user that published a release

git - 如果我将一个文件添加到我的 git 存储库,然后在 gitignore 中添加一个表明该文件被忽略的模式,会发生什么

github - 如何知道 git pull 请求是否通过 github api 获得批准

git - 通过 github API 关闭 pull 请求

php - 与 openCPU 交互

ruby-on-rails - curl - 向 Rails API 请求 json 对象和文件

git - git 仓库的部分共享

api - 如何使用 GitHub GraphQL API 获取具有特定主题的所有存储库?