Git Hub Stats API

Home Projects Git Hub Stats API User Analytics

API Endpoints: User Analytics

Endpoints for retrieving statistics, language data, and contribution history for specific GitHub users.


1. Get User's Programming Languages

Retrieves the programming languages used in a user's repositories.

  • Endpoint: GET /{username}/languages
  • Query Parameters:
    • exclude (Optional): Comma-separated list of languages to exclude (e.g., Markdown,JSON,HTML).

Example Request

GET /tashifkhan/languages?exclude=HTML,CSS

Response

[
	{
		"name": "Python",
		"percentage": 45.0
	},
	{
		"name": "JavaScript",
		"percentage": 30.0
	}
]

2. Get User's Contribution History

Retrieves GitHub contribution history and statistics.

  • Endpoint: GET /{username}/contributions
  • Query Parameters:
    • starting_year (Optional): Starting year for history (defaults to account creation year).

Example Request

GET /tashifkhan/contributions?starting_year=2022

Response

Includes a year-by-year breakdown of contribution data.

{
    "contributions": {
        "2023": { ... }
    },
    "totalCommits": 1234,
    "longestStreak": 30,
    "currentStreak": 15
}

3. Get User's Complete Statistics

Comprehensive statistics combining languages, streaks, and contribution counts.

  • Endpoint: GET /{username}/stats
  • Query Parameters:
    • exclude (Optional): Comma-separated list of languages to exclude.

Response

{
    "status": "success",
    "message": "retrieved",
    "topLanguages": [...],
    "totalCommits": 1234,
    "longestStreak": 30,
    "currentStreak": 15,
    "profile_visitors": 567,
    "contributions": { ... }
}

4. Get and Increment Profile Views

Tracks and increments profile view counts.

  • Endpoint: GET /{username}/profile-views
  • Query Parameters:
    • increment (Optional, default: true): Whether to increment the count.
    • base (Optional): Set a base count (useful for migration).

Response

{
	"username": "tashifkhan",
	"views": 1234,
	"incremented": true
}