|
2 | 2 | title: Custom Mime Types | GitHub API |
3 | 3 | --- |
4 | 4 |
|
5 | | -# Custom Mime Types |
| 5 | +# GitHub Mime Types |
6 | 6 |
|
7 | 7 | Custom mime types are used in the API to let consumers choose the format |
8 | 8 | of the data they wish to receive. This is done by adding one or more of |
9 | 9 | the following types to the `Accept` header when you make a request. Mime |
10 | 10 | types are specific to resources, allowing them to change independently |
11 | 11 | and support formats that other resources don't. |
12 | 12 |
|
13 | | -## Issue |
| 13 | +All GitHub mime types look like this: |
14 | 14 |
|
15 | | -The body of an issue can be written in [GitHub Flavored Markdown][gfm]. |
16 | | -These mime types are allowed: |
| 15 | + application/vnd.github[.version].param[+json] |
| 16 | + |
| 17 | +The most basic mime types the API supports are: |
| 18 | + |
| 19 | + application/json |
| 20 | + application/vnd.github+json |
| 21 | + |
| 22 | +Neither of these specify a version, so you will always get the latest |
| 23 | +JSON representation of resources. If you're building an application and |
| 24 | +care about the stability of the API, specify a version like so: |
| 25 | + |
| 26 | + application/vnd.github.beta+json |
| 27 | + |
| 28 | +If you're specifying a property (such as full/raw/etc defined below), |
| 29 | +put the version before the property: |
| 30 | + |
| 31 | + application/vnd.github.beta.raw+json |
| 32 | + |
| 33 | +For specifics on versions, check the [API changelog](/v3/changelog). |
| 34 | + |
| 35 | +## Comment Body Properties |
| 36 | + |
| 37 | +The body of a comments can be written in [GitHub Flavored Markdown][gfm]. |
| 38 | +Issues, Issue Comments, Pull Request Comments, and Gist Comments all |
| 39 | +accept these same mime types: |
17 | 40 |
|
18 | 41 | ### Raw |
19 | 42 |
|
20 | | - application/vnd.github-issue.raw+json |
| 43 | + application/vnd.github.VERSION.raw+json |
21 | 44 |
|
22 | 45 | Return the raw markdown body. Response will include `body`. This is the |
23 | 46 | default if you do not pass any specific mime type. |
24 | 47 |
|
25 | 48 | ### Text |
26 | 49 |
|
27 | | - application/vnd.github-issue.text+json |
| 50 | + application/vnd.github.VERSION.text+json |
28 | 51 |
|
29 | 52 | Return a text only representation of the markdown body. Response will |
30 | 53 | include `body_text`. |
31 | 54 |
|
32 | 55 | ### Html |
33 | 56 |
|
34 | | - application/vnd.github-issue.html+json |
| 57 | + application/vnd.github.VERSION.html+json |
35 | 58 |
|
36 | 59 | Return html rendered from the body's markdown. Response will include |
37 | 60 | `body_html`. |
38 | 61 |
|
39 | 62 | ### Full |
40 | 63 |
|
41 | | - application/vnd.github-issue.full+json |
| 64 | + application/vnd.github.VERSION.full+json |
42 | 65 |
|
43 | 66 | Return raw, text and html representations. Response will include `body`, |
44 | 67 | `body_text`, and `body_html`: |
45 | 68 |
|
46 | | -## Issue Comment |
47 | | - |
48 | | -The body of an issue comment can also be written in [GitHub Flavored |
49 | | -Markdown][gfm]. The semantics are identical to the Issue resource |
50 | | -described above. These mime types are allowed: |
51 | | - |
52 | | - application/vnd.github-issuecomment.raw+json |
53 | | - application/vnd.github-issuecomment.text+json |
54 | | - application/vnd.github-issuecomment.html+json |
55 | | - application/vnd.github-issuecomment.full+json |
56 | | - |
57 | | -## Commit Comment |
58 | | - |
59 | | -The body of an commit comment can also be written in [GitHub Flavored |
60 | | -Markdown][gfm]. The semantics are identical to the Issue resource |
61 | | -described above. These mime types are allowed: |
62 | | - |
63 | | - application/vnd.github-commitcomment.raw+json |
64 | | - application/vnd.github-commitcomment.text+json |
65 | | - application/vnd.github-commitcomment.html+json |
66 | | - application/vnd.github-commitcomment.full+json |
67 | | - |
68 | | -## Pull Request |
69 | | - |
70 | | -The body of an pull request can also be written in [GitHub Flavored |
71 | | -Markdown][gfm]. The semantics are identical to the Issue resource |
72 | | -described above. These mime types are allowed: |
73 | | - |
74 | | - application/vnd.github-pull.raw+json |
75 | | - application/vnd.github-pull.text+json |
76 | | - application/vnd.github-pull.html+json |
77 | | - application/vnd.github-pull.full+json |
78 | | - |
79 | | -## Pull Request Comment |
80 | | - |
81 | | -The body of an pull request comment can also be written in [GitHub |
82 | | -Flavored Markdown][gfm]. The semantics are identical to the Issue |
83 | | -resource described above. These mime types are allowed: |
84 | | - |
85 | | - application/vnd.github-pullcomment.raw+json |
86 | | - application/vnd.github-pullcomment.text+json |
87 | | - application/vnd.github-pullcomment.html+json |
88 | | - application/vnd.github-pullcomment.full+json |
89 | | - |
90 | | -## Gist Comment |
91 | | - |
92 | | -The body of an gist comment can also be written in [GitHub |
93 | | -Flavored Markdown][gfm]. The semantics are identical to the Issue |
94 | | -resource described above. These mime types are allowed: |
95 | | - |
96 | | - application/vnd.github-gistcomment.raw+json |
97 | | - application/vnd.github-gistcomment.text+json |
98 | | - application/vnd.github-gistcomment.html+json |
99 | | - application/vnd.github-gistcomment.full+json |
100 | | - |
101 | | -## Git Blob |
| 69 | +## Git Blob Properties |
102 | 70 |
|
103 | 71 | The following mime types are allowed when getting a blob: |
104 | 72 |
|
105 | 73 | ### JSON |
106 | 74 |
|
| 75 | + application/vnd.github.VERSION+json |
107 | 76 | application/json |
108 | 77 |
|
109 | 78 | Return JSON representation of the blob with `content` as a base64 |
110 | 79 | encoded string. This is the default if nothing is passed. |
111 | 80 |
|
112 | 81 | ### Raw |
113 | 82 |
|
114 | | - application/vnd.github-blob.raw |
| 83 | + application/vnd.github.VERSION.raw |
115 | 84 |
|
116 | 85 | Return the raw blob data. |
117 | 86 |
|
|
0 commit comments