Skip to main content
Publicamos atualizações frequentes em nossa documentação, e a tradução desta página ainda pode estar em andamento. Para obter as informações mais recentes, acesse a documentação em inglês. Se houver problemas com a tradução desta página, entre em contato conosco.

We've recently moved some of the REST API documentation. If you can't find what you're looking for, you might try the Actions REST API page.

Estatísticas de admin

A API de Estatísticas Administrativas fornece uma variedade de métricas sobre sua instalação.

Só está disponível para administradores do site autenticados. Usuários normais receberão uma mensagem 404 se tentarem acessá-la.

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.

You'll need to use a personal access token:

  • If you connected your GitHub Enterprise Server to an enterprise account and enabled Server Statistics, you'll need a personal access token with the read:enterprise permission.
  • If you connected your GitHub Enterprise Server to an organization account and enabled Server Statistics, you'll need a personal access token with the read:org permission.

For more information on creating a personal access token, see "Creating a personal access token."

Parâmetros

Headers
Nome, Tipo, Descrição
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Nome, Tipo, Descrição
enterprise_or_orgstringObrigatório

The slug version of the enterprise name or the login of an organization.

Parâmetros de consulta
Nome, Tipo, Descrição
date_startstring

A cursor, as given in the Link header. If specified, the query only searches for events after this cursor.

date_endstring

A cursor, as given in the Link header. If specified, the query only searches for events before this cursor.

HTTP response status codes

Status codeDescrição
200

OK

Amostras de código

get/enterprise-installation/{enterprise_or_org}/server-statistics
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: token <TOKEN>" \ 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": "20220111", "ghes_version": "3.5.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" } }