Next: , Up: Overview   [Index]


About GitHub’s APIs

Two stable versions of GitHub’s API:

  1. the REST API, currently v3
    request v3 via the ‘Accept’ header
    • All GitHub media types look like this:
      application/vnd.github[.version].param[+json]
      
      -H "Accept: application/vnd.github.v3+json"
      -H "Accept: application/vnd.github.v3.full+json"
      
    • The most basic media types the API supports are:
      application/json
      application/vnd.github+json
      

      Neither of these specify a version, so you will always get the current default JSON representation of resources.

    • You can specify a version like so:
      application/vnd.github.v3+json
      
    • If you’re specifying a property (such as text/full/raw/html/etc defined below), put the version before the property:
      application/vnd.github.v3.raw+json
      
    • You can check the current version through every response’s headers. Look for the X-GitHub-Media-Type header:
      -H "Accept: application/vnd.github.full+json"
      ==> X-GitHub-Media-Type: github.v3
      -H "Accept: application/vnd.github.v3.full+json"
      ==> X-GitHub-Media-Type: github.v3; param=full; format=json
      
  2. the GraphQL API