Iwko Czerniawski
Iwko Czerniawski

Reputation: 83

Github API sorting search results by the created_at field

How can I create a search query sorted by the created_at field? I've tried:

https://api.github.com/search/repositories?q=blog&sort=created_at&order=desc

and

https://api.github.com/search/repositories?q=blog&sort=created&order=desc

But I get the same results as this query:

https://api.github.com/search/repositories?q=blog

Upvotes: 8

Views: 12351

Answers (2)

android_dev71
android_dev71

Reputation: 617

In addition to what was written till now I found out here another way. That is:

https://api.github.com/users/<user name>/repos?sort=created&direction=desc

For example:

https://api.github.com/users/nadar71/repos?sort=created&direction=desc

Upvotes: 2

kfb
kfb

Reputation: 6532

The sort parameter only takes one of three values: stars, forks or updated:

The sort field. One of stars, forks, or updated. Default: results are sorted by best match.

It doesn't appear to be possible to sort by creation date, but you could read the response of the search query into an array and sort from there.

Upvotes: 10

Related Questions