Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all Java repositories on github using api

I am trying to get a list of all github repositories for a specific language (e.g. Java), without narrowing the search by any specific keyword. Preferably, I want to do this directly from curl, no scripting. The problem is that I've tried formatting the API URL and didn't manage to find the right one, that includes the language=Java parameter but no keyword.

For example, the following URL seems to query for repos with the keywords "language" or "java" in their description, including some Scala and Haskell repos:

 curl -X GET https://api.github.com/legacy/repos/search/language=java

On the other hand, using the ? notation returns empty results:

 curl -X GET https://api.github.com/legacy/repos/search?language=java
 curl -X GET https://api.github.com/legacy/repos/search/?language=java

Lower- or upper-case J also seems irrelevant.

So how do I use the language parameter without specifying a keyword?

Comment: A trick that seems to work is to use a single-letter keyword, repeating from A to Z. Is there a less awkward way?

like image 617
Little Bobby Tables Avatar asked Oct 14 '12 12:10

Little Bobby Tables


1 Answers

I would use this according to the v3 api: https://api.github.com/search/repositories?q=language:Java

In case you want to sort:

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

like image 59
bray Avatar answered Sep 24 '22 13:09

bray