Reputation: 1824
Using GitHub API, how can I count the total number of users/organizations at the time of the request?
Users and Organizations API responses do not contain last
Link header.
Note: Following next
Link header until the last one, is not a solution for me because of the rate limits for a free account.
Upvotes: 6
Views: 4357
Reputation: 45503
You can get user count & organization count using GraphQL API v4 :
{
user: search(type: USER, query: "type:user") {
userCount
}
org: search(type: USER, query: "type:org") {
userCount
}
}
which gives :
{
"data": {
"user": {
"userCount": 24486303
},
"org": {
"userCount": 1629433
}
}
}
type:user
: https://api.github.com/search/users?q=type%3Ausertype:org
: https://api.github.com/search/users?q=type%3AorgThe result gives total_count
field with the required value
It matches the result you can find using Github search :
Upvotes: 11