2017-08-31 121 views
3

我使用GitHub的API,试图找到我的某一天所有提交过滤器。Github的API调用:通过提交者的最新

该查询,果然,回到我所有的提交:

https://api.github.com/search/commits?q=committer-email:[email protected]

但这种查询将返回相同的列表,包括指定日期范围之外的结果:

https://api.github.com/search/commits?q=committer-email:[email protected]&committer-date=2017-08-13..2017-08-14

(这些查询需要一个头被设置:接受:应用/ vnd.github.cloak预览)

为什么提交者的最新参数并不像它应该工作?

这里是提交搜索文档:https://developer.github.com/v3/search/#search-commits

回答

2

有在查询一个小的语法错误。尝试改变&+=:。做了这些改变您的查询就会成为 -

curl -H 'Accept: application/vnd.github.cloak-preview' \https://api.github.com/search/commits?q=committer-email:[email protected]+committer-date:2017-08-13..2017-08-14

当我在我的终端上运行这个,我只是得到一个承诺(见下面的截断的结果)。

Medapas-MacBook-Air:~ medapa$ curl -H 'Accept: application/vnd.github.cloak-preview' \https://api.github.com/search/commits?q=committer-email:[email protected]+committer-date:2017-08-13..2017-08-14 
{ 
    "total_count": 1, 
    "incomplete_results": false, 
    "items": [ 
    { 
     "url": "https://api.github.com/repos/mstricklin/batis00/commits/af9295b930223e394f7f0d742af351ea3ef02351", 
     "sha": "af9295b930223e394f7f0d742af351ea3ef02351", 
     "html_url": "https://github.com/mstricklin/batis00/commit/af9295b930223e394f7f0d742af351ea3ef02351", 
     "comments_url": "https://api.github.com/repos/mstricklin/batis00/commits/af9295b930223e394f7f0d742af351ea3ef02351/comments", 
     "commit": { 
     "url": "https://api.github.com/repos/mstricklin/batis00/git/commits/af9295b930223e394f7f0d742af351ea3ef02351", 
     "author": { 
      "date": "2017-08-13T20:10:55.000-05:00", 
      "name": "mstricklin", 
      "email": "[email protected]" 
     }, 
     "committer": { 
      "date": "2017-08-13T20:10:55.000-05:00", 
      "name": "mstricklin", 
      "email": "[email protected]" 
     }, 
     "message": "01", 
     "tree": { 
      "url": "https://api.github.com/repos/mstricklin/batis00/git/trees/e0fe96439a79eb6d84996f351025488bb0e7114d", 
      "sha": "e0fe96439a79eb6d84996f351025488bb0e7114d" 
     }, 
     "comment_count": 0 
     }, 
     "author": { 
     "login": "invalid-email-address", 
+0

这仍然返回一串日期对我来说:( –

+0

这是非常奇怪的。我已经编辑我的反应,包括搜索结果我得到。 – Poonacha

+1

果然,这对我的作品。我一定是键入它在错误的答案接受:) –