使用 GitHub API ,如何计算请求时的用户/组织总数?
Users和 Organizations API 响应不包含 last
Link header .
备注 : 关注 next
链接头直到最后一个,对我来说不是解决方案,因为 rate limits免费帐户。
最佳答案
GraphQL API v4
您可以使用 GraphQL API v4 获取用户计数和组织计数:
{
user: search(type: USER, query: "type:user") {
userCount
}
org: search(type: USER, query: "type:org") {
userCount
}
}
Try it in the explorer
这使 :
{
"data": {
"user": {
"userCount": 24486303
},
"org": {
"userCount": 1629433
}
}
}
REST API v3
type:user
搜索查询:https://api.github.com/search/users?q=type%3Auser type:org
搜索查询:https://api.github.com/search/users?q=type%3Aorg 结果给出
total_count
具有所需值的字段它匹配您可以使用 Github 搜索找到的结果:
关于GitHub API 获取用户/组织总数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47502683/