taetaetae
taetaetae

Reputation: 181

Can't you specify a date range when searching the repository corresponding to topic using github api?

You are going to search for a repository with registered topic using github api.

However, since the search results are limited to 1000, I would like to search the date as a limit. Like below.

https://api.github.com/search/repositories?q=topic:AAA&createdat:2020-10-11

Is there any other way since I ignored the date and searched?

I'd like to ask for your help. Thank you.

Upvotes: 10

Views: 17588

Answers (1)

Bertrand Martel
Bertrand Martel

Reputation: 45432

There are a few issues in your query :

  • the correct search query term is created (not createdat)

  • the search query parameters are delimited by spaces like this :

    topic:AAA created:2020-10-11
    

Your query would be : https://api.github.com/search/repositories?q=topic:AAA%20created:2020-10-11

From the doc :

You can search for dates that are earlier or later than another date, or that fall within a range of dates, by using >, >=, <, <=, and range queries. Date formatting must follow the ISO8601 standard, which is YYYY-MM-DD (year-month-day).

A few examples:

  • created after date:

https://api.github.com/search/repositories?q=topic:AAA%20created:%3E2017-10-11

  • created between date:

https://api.github.com/search/repositories?q=topic:AAA%20created:2017-01-01..2018-01-01

Upvotes: 21

Related Questions