Reputation: 276
I would like to list public GitHub repositories with the latest create/update/push timestamps (for me any of these is acceptable). Can I achieve this with the GitHub API?
I have tried the following:
Tried using /repositories
endpoint, and use the link header to navigate to the last page. However, the link header I receive only has first
and next
links, whereas I need a last
link.
Tried using /search/repositories
endpoint. This will work as long as I have a keyword or filter in the q
parameter, but it will not accept an empty q
parameter.
Upvotes: 2
Views: 75
Reputation: 276
I got in touch with GitHub support, and there are two solutions to this:
Use binary search on the since
parameter of the /repositories
endpoint to find the last page.
Cons: may quickly exhaust the API rate limit.
Use the /search/repositories
endpoint with an always-true predicate such as stars>=0
.
Cons: likely to cause a query timeout/ incomplete results.
Upvotes: 1