Table of Contents
Overview
All requests to https://api.github.com
receive the v3
version of the REST API. It is encouraged that the v3 version is explicitly requested via the Accept
header:
Accept: application/vnd.github.v3+json
Authentication
Note: Requests that require authentication will return 404 Not Found
instead of 403 Forbidden
, in some places.
Basic authentication:
$ curl -u "username" https://api.github.com
OAuth2 token:
$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com
OAuth2 key/secret:
$ curl -u my_client_id:my_client_secret 'https://api.github.com/user/repos'
Available Libraries
- GitHub for Dart
- GitHub client library for Emacs
- Go client library for accessing the GitHub API v3
- GitHub API for Java
- NodeJS GitHub Library
- Julia interface to GitHub API
- PHP GitHub API
- GitHub bridge for Laravel
- Python library to access GitHub API
- GitHub Flask
Useful Endpoints
GET /events
Note: public event feeds are delayed by five minutes
GET /notifications
List all notifications for the current user, sorted by most recently updated.
POST /repos/{owner}/{repo}/statuses/{sha}
Note: there is a limit of 1000 statuses per sha and context within a repository.
GET /repos/{owner}/{repo}/languages
PUT /repos/{owner}/{repo}/vulnerability-alerts
Project Ideas
- Build a Dynamic Portfolio
I personally have used GitHub API in my portfolio website. My site automatically displays:
- Each GitHub repository
- The date that each repo was last updated
- Symbols corresponding to the languages used in each repo
- Each repository is also linked back to the respective GitHub repo itself
Check out the article I posted here:
You can build a dashboard to track any open source project!
ghapi is a third-party Python library and CLI client for the GitHub API. ghapi automatically manages required headers, query strings, route parameters, post data, and much more! How interesting!
What are your favorite things to do with GitHub API?
Happy coding!
Top comments (2)
Nice explanation!
Thanks