GitHub API

Table of Contents

Overview
Available Libraries
Useful Endpoints
Project Ideas with GitHub API

Overview

All requests to https://api.github.com receive the v3 version of the REST API. It is encouraged that the v3 version is expli…


This content originally appeared on DEV Community and was authored by Tina Huynh

Table of Contents

  1. Overview
  2. Available Libraries
  3. Useful Endpoints
  4. Project Ideas with GitHub API

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

Useful Endpoints

  • GET /events

Note: public event feeds are delayed by five minutes
curl events

  • GET /notifications

List all notifications for the current user, sorted by most recently updated.
await notifs

  • POST /repos/{owner}/{repo}/statuses/{sha}

Note: there is a limit of 1000 statuses per sha and context within a repository.
post commits

  • GET /repos/{owner}/{repo}/languages

Image description

  • PUT /repos/{owner}/{repo}/vulnerability-alerts

Image description

Project Ideas

  1. 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:

  1. Build a GitHub Dashboard

You can build a dashboard to track any open source project!

  1. Learn about ghapi

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!


This content originally appeared on DEV Community and was authored by Tina Huynh


Print Share Comment Cite Upload Translate Updates
APA

Tina Huynh | Sciencx (2022-04-18T11:10:56+00:00) GitHub API. Retrieved from https://www.scien.cx/2022/04/18/github-api/

MLA
" » GitHub API." Tina Huynh | Sciencx - Monday April 18, 2022, https://www.scien.cx/2022/04/18/github-api/
HARVARD
Tina Huynh | Sciencx Monday April 18, 2022 » GitHub API., viewed ,<https://www.scien.cx/2022/04/18/github-api/>
VANCOUVER
Tina Huynh | Sciencx - » GitHub API. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/04/18/github-api/
CHICAGO
" » GitHub API." Tina Huynh | Sciencx - Accessed . https://www.scien.cx/2022/04/18/github-api/
IEEE
" » GitHub API." Tina Huynh | Sciencx [Online]. Available: https://www.scien.cx/2022/04/18/github-api/. [Accessed: ]
rf:citation
» GitHub API | Tina Huynh | Sciencx | https://www.scien.cx/2022/04/18/github-api/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.