GitHub API:如何有效地获取每个存储库的问题总数?
GitHub API: how efficiently get the total count of Issues per repository?
https://api.github.com/repos/{org}/{repo}/issues
什么查询可以让我们找到问题总数?
使用 Rest API,您可以使用搜索 api:
GET https://api.github.com/search/issues?q=repo:bertrandmartel/tableau-scraping%20is:issue
https://api.github.com/search/issues?q=repo:bertrandmartel/tableau-scraping%20is:issue
输出
{
"total_count": 8,
....
}
您还可以通过以下请求使用 Github graphql API:
{
repository(owner: "mui-org", name: "material-ui") {
issues {
totalCount
}
}
}
卷曲:
curl -H "Authorization: token YOUR_TOKEN" \
-H "Content-Type:application/json" \
-d '{
"query": "{ repository(owner: \"mui-org\", name: \"material-ui\") { issues { totalCount } } }"
}' https://api.github.com/graphql
示例输出:
{
"data": {
"repository": {
"issues": {
"totalCount": 12760
}
}
}
}
https://api.github.com/repos/{org}/{repo}/issues
什么查询可以让我们找到问题总数?
使用 Rest API,您可以使用搜索 api:
GET https://api.github.com/search/issues?q=repo:bertrandmartel/tableau-scraping%20is:issue
https://api.github.com/search/issues?q=repo:bertrandmartel/tableau-scraping%20is:issue
输出
{
"total_count": 8,
....
}
您还可以通过以下请求使用 Github graphql API:
{
repository(owner: "mui-org", name: "material-ui") {
issues {
totalCount
}
}
}
卷曲:
curl -H "Authorization: token YOUR_TOKEN" \
-H "Content-Type:application/json" \
-d '{
"query": "{ repository(owner: \"mui-org\", name: \"material-ui\") { issues { totalCount } } }"
}' https://api.github.com/graphql
示例输出:
{
"data": {
"repository": {
"issues": {
"totalCount": 12760
}
}
}
}