Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search repositories with github api v3 based on language and user name

Tags:

github-api

I am trying to search for repositories based on the language "java" and user name "atermenji" (as an example). I get a different result when I search with the code search page of github https://github.com/search?utf8=%E2%9C%93&q=language%3Ajava+user%3Aatermenji&type=Repositories&ref=searchresults

When I try to do the same search with the api I get a different result.

curl -H 'Accept: application/vnd.github.preview.text-match+json' https://api.github.com/search/repositories?q=language:java&user=atermenji

There seems to be a problem in using the two parameters together as well. It seems like it is searching only based on the language not the user. Please advice.

Thanks.

like image 872
Omar1983 Avatar asked Dec 27 '25 20:12

Omar1983


1 Answers

Try this to get all user repositories.

https://api.github.com/users/:username/repos

To my own understanding, the GitHub API get all repositories of a user but not with languages. It is important to understand that most repos have different languages hence from the GitHub API documentation, the parameters allow for searching user repo are the type, sort and direction of which there is no parameter for language for now.

To get a specific language of a repository, try:

GET /repos/:owner/:repo/languages

like image 63
ogbeks Avatar answered Dec 30 '25 22:12

ogbeks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!