适用于管理员统计信息的 REST API 终结点
使用 REST API 检索有关安装的各种指标。
关于管理统计
这些终结点仅适用于经过身份验证的网站管理员。 普通用户将收到 404
响应。
这些终结点仅支持使用 personal access token (classic) 进行身份验证。 有关详细信息,请参阅“管理个人访问令牌”。
Get all statistics
“Get all statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get all statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get all statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/all
Response
Status: 200
{
"repos": {
"total_repos": 212,
"root_repos": 194,
"fork_repos": 18,
"org_repos": 51,
"total_pushes": 3082,
"total_wikis": 15
},
"hooks": {
"total_hooks": 27,
"active_hooks": 23,
"inactive_hooks": 4
},
"pages": {
"total_pages": 36
},
"orgs": {
"total_orgs": 33,
"disabled_orgs": 0,
"total_teams": 60,
"total_team_members": 314
},
"users": {
"total_users": 254,
"admin_users": 45,
"suspended_users": 21
},
"pulls": {
"total_pulls": 86,
"merged_pulls": 60,
"mergeable_pulls": 21,
"unmergeable_pulls": 3
},
"issues": {
"total_issues": 179,
"open_issues": 83,
"closed_issues": 96
},
"milestones": {
"total_milestones": 7,
"open_milestones": 6,
"closed_milestones": 1
},
"gists": {
"total_gists": 178,
"private_gists": 151,
"public_gists": 25
},
"comments": {
"total_commit_comments": 6,
"total_gist_comments": 28,
"total_issue_comments": 366,
"total_pull_request_comments": 30
}
}
Get comment statistics
“Get comment statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get comment statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get comment statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/comments
Response
Get gist statistics
“Get gist statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get gist statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get gist statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/gists
Response
Get hooks statistics
“Get hooks statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get hooks statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get hooks statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/hooks
Response
Get issue statistics
“Get issue statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get issue statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get issue statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/issues
Response
Get milestone statistics
“Get milestone statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get milestone statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get milestone statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/milestones
Response
Get organization statistics
“Get organization statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get organization statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get organization statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/orgs
Response
Get pages statistics
“Get pages statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get pages statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get pages statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/pages
Response
Get pull request statistics
“Get pull request statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get pull request statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get pull request statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/pulls
Response
Get repository statistics
“Get repository statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get repository statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get repository statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/repos
Response
Get security products statistics
Gets the statistics about security products for a GitHub Enterprise Server instance.
To use this endpoint, you must be a site admin.
“Get security products statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get security products statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get security products statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/security-products
Response
Status: 200
{
"total_repos": 150,
"nonarchived_repos": 130,
"secret_scanning_enabled_repos": 150,
"secret_scanning_push_protection_enabled_repos": 120,
"code_scanning_enabled_repos": 140,
"code_scanning_pr_reviews_enabled_repos": 100,
"code_scanning_default_setup_enabled_repos": 50,
"code_scanning_default_setup_eligible_repos": 30,
"dependabot_alerts_enabled_repos": 130,
"dependabot_security_updates_enabled_repos": 120,
"dependabot_version_updates_enabled_repos": 121,
"advanced_security_enabled_repos": 150,
"active_committers": 30,
"purchased_committers": 90,
"maximum_committers": 80
}
Get users statistics
“Get users statistics”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Get users statistics”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get users statistics”的示例代码
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/enterprise/stats/users
Response