Mazharul  Islam
Mazharul Islam

Reputation: 327

Getting the count of GitHub repositories for a search query

I want to get the total count of GitHub repositories having oauth implementations in Spring framework. I can use this query https://api.github.com/search/repositories?q=oauth+spring+language:java&order=asc&per_page=100 which returns the GitHub repositories I am looking for with 100 repositories per page.

But GitHub API can return a maximum of 1000 repositories. Hence when I go to the 11-th page with the query https://api.github.com/search/repositories?q=oauth+spring+language:java&order=asc&per_page=100&page=11 GitHub API returns the following

{ "message": "Only the first 1000 search results are available", "documentation_url": "https://developer.github.com/v3/search/" }

Can anyone give any search query which would give me the count of GitHub repositories having oauth implementations in Spring framework?

Thanks in advance.

Upvotes: 0

Views: 1269

Answers (1)

Brendan Forster
Brendan Forster

Reputation: 2718

The total_count field on the first response will show the total count of repositories matching. For your example, I see 3530 results:

{
  "total_count": 3530,
  "incomplete_results": false,
  "items": [
    // items in here
  ]
}

Upvotes: 1

Related Questions