Reputation: 520
If I make the following GET request to the GitHub API, I get about 58 entries:
https://api.github.com/search/repositories?&per_page=250&sort=updated&order=asc&q=%22github-octocat%22
However, the following with any date parameters return 0 entries:
Created since date: ( created:>=2010-09-01
)
https://api.github.com/search/repositories?&per_page=250&sort=updated&order=asc&q=%22github-octocat+created:>=2010-09-01%22
Date range: ( created:2012-08-13..2020-08-14
)
https://api.github.com/search/repositories?&per_page=250&sort=updated&order=asc&q=%22github-octocat+created:2012-08-13..2020-08-14%22
In the GitHub docs, under the section Constructing a search query, the syntax is outlined as such:
SEARCH_KEYWORD_1 SEARCH_KEYWORD_N QUALIFIER_1 QUALIFIER_N
Thei GitHub docs at Search by when a repository was created or last updated outlines date formats like the two above, and Query for values between a range outlines valid combinations of them. I suspect these examples are not meant for this use, as the examples use URLs intended for browsers, such as https://github.com/search?q=case+pushed%3A%3E%3D2013-03-06+fork%3Aonly&type=Repositories
, instead of api.github.com
, which is confusing too.
I'm trying to apply the patterns shown in the following resources in order to get a range of dates filter:
Any pointers greatly appreciated.
Upvotes: 1
Views: 3318
Reputation: 520
Even though the GitHub docs outlines the syntax as such:
SEARCH_KEYWORD_1 SEARCH_KEYWORD_N QUALIFIER_1 QUALIFIER_N
the parameters for date or similar, are not valid unless placed outside the q
parameter. Instead of including date
qualifier inside of the double quotes (shown as %22
below):
q=%22mysearch+pushed%3A2017-09-01..2020-10-01+sort:updated%22
Pull them out, and add them after the closing quote of the q
parameter:
q=%22mystring%22+pushed%3A2017-09-01..2020-10-01+sort:updated
Upvotes: 0