Skip to main content

Esta versão do GitHub Enterprise Server foi descontinuada em 2024-07-09. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, segurança aprimorada e novos recursos, atualize para a última versão do GitHub Enterprise Server. Para obter ajuda com a atualização, entre em contato com o suporte do GitHub Enterprise.

O controle de versão da API REST já foi feito. Para obter mais informações, confira "Sobre o controle de versão da API".

Pontos de extremidade da API REST para estatísticas de administrador

Use a API REST para recuperar uma variedade de métricas sobre sua instalação.

Sobre as estatísticas de administração

Esses pontos de extremidade só estão disponíveis para administradores de site autenticados. Os usuários normais receberão uma resposta 404.

Get all statistics

Exemplos de código para "Get all statistics"

Exemplo de solicitação

get/enterprise/stats/all
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

Exemplos de código para "Get comment statistics"

Exemplo de solicitação

get/enterprise/stats/comments
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

Status: 200
{ "total_commit_comments": 5000, "total_gist_comments": 400, "total_issue_comments": 10900, "total_pull_request_comments": 9900 }

Get gist statistics

Exemplos de código para "Get gist statistics"

Exemplo de solicitação

get/enterprise/stats/gists
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

Status: 200
{ "total_gists": 500, "private_gists": 30, "public_gists": 470 }

Get hooks statistics

Exemplos de código para "Get hooks statistics"

Exemplo de solicitação

get/enterprise/stats/hooks
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

Status: 200
{ "total_hooks": 50, "active_hooks": 47, "inactive_hooks": 3 }

Get issue statistics

Exemplos de código para "Get issue statistics"

Exemplo de solicitação

get/enterprise/stats/issues
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

Status: 200
{ "total_issues": 5000, "open_issues": 300, "closed_issues": 4700 }

Get milestone statistics

Exemplos de código para "Get milestone statistics"

Exemplo de solicitação

get/enterprise/stats/milestones
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

Status: 200
{ "total_milestones": 90, "open_milestones": 10, "closed_milestones": 80 }

Get organization statistics

Exemplos de código para "Get organization statistics"

Exemplo de solicitação

get/enterprise/stats/orgs
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

Status: 200
{ "total_orgs": 50, "disabled_orgs": 1, "total_teams": 70, "total_team_members": 700 }

Get pages statistics

Exemplos de código para "Get pages statistics"

Exemplo de solicitação

get/enterprise/stats/pages
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

Status: 200
{ "total_pages": 20 }

Get pull request statistics

Exemplos de código para "Get pull request statistics"

Exemplo de solicitação

get/enterprise/stats/pulls
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

Status: 200
{ "total_pulls": 1200, "merged_pulls": 1100, "mergeable_pulls": 90, "unmergeable_pulls": 10 }

Get repository statistics

Exemplos de código para "Get repository statistics"

Exemplo de solicitação

get/enterprise/stats/repos
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

Status: 200
{ "total_repos": 200, "root_repos": 1, "fork_repos": 10, "org_repos": 150, "total_pushes": 39000, "total_wikis": 5 }

Get users statistics

Exemplos de código para "Get users statistics"

Exemplo de solicitação

get/enterprise/stats/users
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

Status: 200
{ "total_users": 100, "admin_users": 3, "suspended_users": 1 }