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.
Github readme stats allows you to simply add a markdown image link and it will show you realtime stats for your github account. And the cool thing is since it's just an image you can embed it anywhere even on Dev.to posts!
You can view a list of members in your enterprise who don't have an email address from a verified domain associated with their user account on GitHub.com. In the top-right corner of GitHub.com, click your profile photo, then click Your enterprises. In the list of enterprises, click the enterprise you want to view.
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
}
}
Try it in the explorer
which gives :
{
"data": {
"user": {
"userCount": 24486303
},
"org": {
"userCount": 1629433
}
}
}
type:user
: https://api.github.com/search/users?q=type%3Auser
type:org
: https://api.github.com/search/users?q=type%3Aorg
The result gives total_count
field with the required value
It matches the result you can find using Github search :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With