Search code examples
githubgithub-api

Why i receive different result searching repositories?


I try find latest updated repo on GitHub.

I use this two methods:

https://api.github.com/search/repositories?q=user:github+sort:updated+&per_page=5&type=all

https://api.github.com/users/github/repos?type=all&sort=updated&per_page=5

Why i get differend repos? Which method is working?

On GitHub web site i can see results like in the first link:

https://github.com/github


Solution

  • I went through the results of both the requests. It looks like in the first case sort:updated uses pushed_at field to sort the results. In the second case, sort=updatedis using updated_at field to sort the results. So, depending on which field you would like to sort your results, you could use either. Strangely, i could not find any documentation of this difference.