Skip to main content
我们经常发布文档更新,此页面的翻译可能仍在进行中。 有关最新信息,请访问英语文档

此版本的 GitHub Enterprise 已停止服务 2023-03-15. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

我们最近移动了一些 REST API 文档。 如果找不到要查找的内容,可以尝试 操作 REST API 页面。

管理统计

使用 REST API 检索有关安装的各种指标。

关于管理统计

这些终结点仅适用于经过身份验证的网站管理员。 普通用户将收到 404 响应。

Get all statistics

“Get all statistics”的示例代码

get/enterprise/stats/all
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ 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”的示例代码

get/enterprise/stats/comments
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/comments

Response

Get gist statistics

“Get gist statistics”的示例代码

get/enterprise/stats/gists
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/gists

Response

Get hooks statistics

“Get hooks statistics”的示例代码

get/enterprise/stats/hooks
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/hooks

Response

Get issue statistics

“Get issue statistics”的示例代码

get/enterprise/stats/issues
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/issues

Response

Get milestone statistics

“Get milestone statistics”的示例代码

get/enterprise/stats/milestones
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/milestones

Response

Get organization statistics

“Get organization statistics”的示例代码

get/enterprise/stats/orgs
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/orgs

Response

Get pages statistics

“Get pages statistics”的示例代码

get/enterprise/stats/pages
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/pages

Response

Get pull request statistics

“Get pull request statistics”的示例代码

get/enterprise/stats/pulls
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/pulls

Response

Get repository statistics

“Get repository statistics”的示例代码

get/enterprise/stats/repos
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/repos

Response

Get users statistics

“Get users statistics”的示例代码

get/enterprise/stats/users
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprise/stats/users

Response