管理統計の REST API エンドポイント
REST API を使って、インストールに関するさまざまなメトリックを取得します。
Note
これらのエンドポイントでは、personal access token (classic) を使う認証のみがサポートされます。 詳しくは、「個人用アクセス トークンを管理する」を参照してください。
Get GitHub Enterprise Server statistics
Returns aggregate usage metrics for your GitHub Enterprise Server 3.5+ instance for a specified time period up to 365 days.
To use this endpoint, your GitHub Enterprise Server instance must be connected to GitHub Enterprise Cloud using GitHub Connect. You must enable Server Statistics, and for the API request provide your enterprise account name or organization name connected to the GitHub Enterprise Server. For more information, see "Enabling Server Statistics for your enterprise" in the GitHub Enterprise Server documentation.
OAuth app tokens and personal access tokens (classic) need:
- the
read:enterprise
scope if you connected your GitHub Enterprise Server to an enterprise account and enabled Server Statistics - the
read:org
scope if you connected your GitHub Enterprise Server to an organization account and enabled Server Statistics
"Get GitHub Enterprise Server statistics" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには、次のアクセス許可セットの少なくとも 1 つが必要です:
- "Administration" organization permissions (read)
- "Enterprise administration" business permissions (read)
"Get GitHub Enterprise Server statistics" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
enterprise_or_org string 必須The slug version of the enterprise name or the login of an organization. |
名前, Type, 説明 |
---|
date_start string A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. |
date_end string A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. |
"Get GitHub Enterprise Server statistics" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
"Get GitHub Enterprise Server statistics" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com
を api.SUBDOMAIN.ghe.com
にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprise-installation/ENTERPRISE_OR_ORG/server-statistics
Response
Status: 200
{
"server_id": "ea6088f3-f095-4bf2-8d7f-c573819e8768",
"collection_date": "2021-12-14T23:59:59Z",
"schema_version": "20230306",
"ghes_version": "3.9.0",
"host_name": "github.example.com",
"github_connect": {
"features_enabled": [
"license_usage_sync",
"content_analysis",
"content_analysis_notifications"
]
},
"ghe_stats": {
"comments": {
"total_commit_comments": 1000,
"total_gist_comments": 1000,
"total_issue_comments": 0,
"total_pull_request_comments": 0
},
"gists": {
"total_gists": 100,
"private_gists": 59,
"public_gists": 41
},
"hooks": {
"total_hooks": 2,
"active_hooks": 1,
"inactive_hooks": 1
},
"issues": {
"total_issues": 3421,
"open_issues": 1234,
"closed_issues": 1222
},
"milestones": {
"total_milestones": 50,
"open_milestones": 20,
"closed_milestones": 30
},
"orgs": {
"total_orgs": 100,
"disabled_orgs": 22,
"total_teams": 299,
"total_team_members": 400
},
"pages": {
"total_pages": 10
},
"pulls": {
"total_pulls": 1232,
"merged_pulls": 223,
"mergeable_pulls": 435,
"unmergeable_pulls": 0
},
"repos": {
"total_repos": 12,
"root_repos": 1,
"fork_repos": 2,
"org_repos": 1,
"total_pushes": 42,
"total_wikis": 1
},
"users": {
"total_users": 2000,
"admin_users": 299,
"suspended_users": 423
}
},
"dormant_users": {
"total_dormant_users": 5,
"dormancy_threshold": "90 days"
},
"actions_stats": {
"$ref": "server-statistics-actions.yaml"
},
"packages_stats": {
"$ref": "server-statistics-packages.yaml"
},
"advisory_db_stats": {
"$ref": "server-statistics-advisory-db.yaml"
}
}