I wanted to fetch GitHub repositories that come under a certain topic from the GitHub API.
For eg. I fetch all repos using https://api.github.com/repositories
.
And I fetch a topic by using https://api.github.com/search/topics?q=<TOPIC_NAME>
.
But I want to fetch repositories that come under a topic. Let's say for JavaScript: https://github.com/topics/javascript
All the repos that are on this webpage is what I want to fetch using GitHub API. Is there a way I can do that?
CodePudding user response:
Try this API URL:
const url = `https://api.github.com/search/repositories?q=topic:${TOPIC}`
curl request for the same if you are using any API client:
curl --request GET \
--url 'https://api.github.com/search/repositories?q=topic:javascript' \
--header 'accept: application/vnd.github.mercy-preview json'