2017-08-31 119 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

果然,這對我的作品。我一定是鍵入它在錯誤的答案接受:) –