Skip to content

Instantly share code, notes, and snippets.

@watsonian
Created February 7, 2012 09:51
Show Gist options
  • Save watsonian/ada932a9d0fb5c92eeab to your computer and use it in GitHub Desktop.
Save watsonian/ada932a9d0fb5c92eeab to your computer and use it in GitHub Desktop.
Enterprise Admin Stats API

Overview

This API is available to pull a variety of metrics back about your installation. Any admin user can access this API. Normal users will receive a 404 response if they try accessing it. There are plans to improve this further, so this API may change in a future version. If it does, the changes will be mentioned in the release notes. To access the API, you hit the following endpoint:

http(s)://[hostname]/api/v3/enterprise/stats/

Available Requests

There are a variety of options to choose from:

  • all - returns all available stats
  • repos - returns only repository-related stats
  • hooks - returns only hooks-related stats
  • pages - returns only pages-related stats
  • orgs - returns only organization-related stats
  • users - returns only user-related stats
  • pulls - returns only pull request-related stats
  • issues - returns only issue-related stats
  • milestones - returns only milestone-related stats
  • gists - returns only gist-related stats
  • comments - returns only comment-related stats

These stats are cached and update roughly every 10 minutes.

Sample Request

curl http://user:[email protected]/api/v3/enterprise/stats/all
{
  "issues": {
    "total_issues": 610,
    "closed_issues": 505,
    "open_issues": 105
  },
  "hooks": {
    "total_hooks": 0,
    "active_hooks": 0,
    "inactive_hooks": 0
  },
  "milestones": {
    "closed_milestones": 7,
    "open_milestones": 4,
    "total_milestones": 11
  },
  "orgs": {
    "total_team_members": 232,
    "disabled_orgs": 0,
    "total_orgs": 17,
    "total_teams": 32
  },
  "comments": {
    "total_gist_comments": 0,
    "total_commit_comments": 80,
    "total_pull_request_comments": 47,
    "total_issue_comments": 1166
  },
  "pages": {
    "total_pages": 3
  },
  "users": {
    "disabled_user": 0,
    "admin_users": 48,
    "total_users": 507
  },
  "gists": {
    "private_gists": 0,
    "public_gists": 0,
    "total_gists": 0
  },
  "pulls": {
    "mergeable_pulls": 38,
    "merged_pulls": 178,
    "unmergeable_pulls": 11,
    "total_pulls": 250
  },
  "repos": {
    "fork_repos": 7,
    "root_repos": 153,
    "total_repos": 153,
    "total_pushes": 0,
    "org_repos": 17,
    "total_wikis": 0
  }
}
@mynameistechno
Copy link

Any plans to allow non-admin users to access the stats API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment