cuomo
cuomo

Reputation: 71

Get n repositories with most stars out of a given organization - Github API

What's the easiest way to get the 'most starred' repositories out of a given organization using the Github API? Is there a parameter option for this? I'm currently making a request to

http://api.github.com/orgs/ORGANIZATION/repos

and then filtering with my own code, but I wondered if the Github team implemented anything like that already.

Upvotes: 1

Views: 696

Answers (1)

Bertrand Martel
Bertrand Martel

Reputation: 45433

You can use the search API, specify your org and sort by stars:

https://api.github.com/search/repositories?q=org:YOUR_ORGg&sort=stars&order=desc

Example: https://api.github.com/search/repositories?q=org:mui-org&sort=stars&order=desc

You can limit to the top X repo using per_page (if X < 100). For instance to get the top 3 repo with most stars in the org mui-org:

https://api.github.com/search/repositories?q=org:mui-org&sort=stars&order=desc&per_page=3

Upvotes: 2

Related Questions