- API v3 media type and the future
- Comment Body Properties
- Git Blob Properties
- Commits, Commit comparison, and Pull Requests
GitHub Media Types
Custom media types are used in the API to let consumers choose the format
of the data they wish to receive. This is done by adding one or more of
the following types to the
Accept header when you make a request. Media types
are specific to resources, allowing them to change independently and support
formats that other resources don’t.
All GitHub media types look like this:
The most basic media types the API supports are:
Neither of these specify a version, so you will always get the latest JSON representation of resources. If you’re building an application and care about the stability of the API, specify a version like so:
If you’re specifying a property (such as full/raw/etc defined below), put the version before the property:
You can check the current version through every response’s headers. Look
$ curl https://api.github.com/users/technoweenie -I HTTP/1.1 200 OK X-GitHub-Media-Type: github.beta $ curl https://api.github.com/users/technoweenie -I \ -H "Accept: application/vnd.github.full+json" HTTP/1.1 200 OK X-GitHub-Media-Type: github.beta; param=full; format=json $ curl https://api.github.com/users/technoweenie -I \ -H "Accept: application/vnd.github.v3.full+json" HTTP/1.1 200 OK X-GitHub-Media-Type: github.v3; param=full; format=json
API v3 media type and the future
We’ll clearly mark those methods that publicly support the v3 media type.
NOTE: Using the v3 media type for methods other than those marked may yield unexpected results.
Comment Body Properties
The body of a comment can be written in GitHub Flavored Markdown. Issues, Issue Comments, Pull Request Comments, and Gist Comments all accept these same media types:
Return the raw markdown body. Response will include
body. This is the
default if you do not pass any specific media type.
Return a text only representation of the markdown body. Response will
Return html rendered from the body’s markdown. Response will include
Return raw, text and html representations. Response will include
Git Blob Properties
The following media types are allowed when getting a blob:
Return JSON representation of the blob with
content as a base64
encoded string. This is the default if nothing is passed.
Return the raw blob data.
Commits, Commit comparison, and Pull Requests