Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 2

Searching for repositories that use a specific file extension

Couldn't see this in the dropdown. I'm trying to phrase a query with the Search API that'll return a list of all public repositories that have a specific file extension. 

For example if I wanted to get all that contain a .json file. 

Right now I've tried: 

But I'm struggling to find good examples I can use.
1 Reply
Community Manager
Message 2 of 2

Re: Searching for repositories that use a specific file extension

Hey @ljsikuade,

 

Thanks for being here! You can search by file extension, per the docs:

 

Suppose you want to search for popular Tetris repositories written in Assembly. Your query might look like this.

curl https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc

You can search for multiple topics by adding more topic: instances, and including the mercy-preview header. For example:

curl -H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories?q=topic:ruby+topic:rails

In this request, we're searching for repositories with the word tetris in the name, the description, or the README. We're limiting the results to only find repositories where the primary language is Assembly. 

 

Check out the docs for more info.

 

I hope this helps!

Andrea

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!