@@ -4,56 +4,40 @@ title: Gists API v3 | developer.github.com
44
55# Gists API
66
7- The Gist API v3 has been unified into the core GitHub API and can be
8- accessed via the domain api.github.com. SSL is required so the base url
9- for all API calls should be: ` https://api.github.com ` .
10- Please see the [ summary] ( /v3/ ) for a complete description of the API
11- including information about data format and authentication.
7+ ## List gists
128
13- ## List a user's gists
9+ List a user's gists:
1410
1511 GET /users/:user/gists
1612
17- ### Response
18-
19- <%= headers 200, : pagination => true %>
20- <%= json(: gist ) { |h| [ h] } %>
21-
22- ## List your gists
23- This will return a list of your gists, or if called anonymously it will
24- return a list of all public gists.
13+ List the authenticated user's gists or if called anonymously, this will
14+ returns all public gists:
2515
2616 GET /gists
2717
28- ### Response
29- The response is identical to [ listing a user's gists] ( #list-a-users-gists ) .
30-
31- ## List public gists
32- This will return a list of all public gists.
18+ List all public gists:
3319
3420 GET /gists/public
3521
36- ### Response
37- The response is identical to [ listing a user's gists] ( #list-a-users-gists ) .
38-
39- ## List your starred gists
40- This will return a list of your starred gists.
22+ List the authenticated user's starred gists:
4123
4224 GET /gists/starred
4325
4426### Response
45- The response is identical to [ listing a user's gists] ( #list-a-users-gists ) .
27+
28+ <%= headers 200, : pagination => true %>
29+ <%= json(: gist ) { |h| [ h] } %>
4630
4731## Get a single gist
4832
49- GET /gists/: id
33+ GET /gists/:id
5034
5135### Response
5236
5337<%= headers 200 %>
5438<%= json : full_gist %>
5539
56- ## Create a new gist
40+ ## Create a gist
5741
5842 POST /gists
5943
@@ -62,14 +46,13 @@ The response is identical to [listing a user's gists](#list-a-users-gists).
6246<%= json \
6347 : description => "the description for this gist",
6448 : public => true,
65- : files => {
49+ : files => {
6650 "file1.txt" => {"content" => "String file contents"}
6751 } %>
6852
6953### Response
7054
71- <%= headers 201,
72- : Location => "https://api.github.com/users/:user/gists/1 " %>
55+ <%= headers 201, : Location => "https://api.github.com/gists/1 " %>
7356<%= json : full_gist %>
7457
7558## Edit a gist
@@ -78,10 +61,16 @@ The response is identical to [listing a user's gists](#list-a-users-gists).
7861
7962### Input
8063
64+ All files from the previous version of the gist are carried over by
65+ default.
66+
8167<%= json \
8268 : description => "the description for this gist",
8369 : files => {
84- "file1.txt" => {"content" => "String file contents"}
70+ "file1.txt" => {"content" => "updated file contents"},
71+ "old_name.txt" => {"filename" => "new_name.txt", "content" => "modified contents"},
72+ "new_file.txt" => {"content" => "a new file"},
73+ "delete_this_file.txt" => nil,
8574 } %>
8675
8776### Response
@@ -95,38 +84,35 @@ The response is identical to [listing a user's gists](#list-a-users-gists).
9584
9685### Response
9786
98- <%= headers 201,
99- : Location => "https://api.github.com/users/user/gists/1 " %>
100- <%= json({}) %>
87+ <%= headers 204 %>
10188
10289## Unstar a gist
10390
10491 DELETE /gists/:id/star
10592
10693### Response
10794
108- <%= headers 204, : no_response => true %>
95+ <%= headers 204 %>
10996
11097## Check if a gist is starred
11198
11299 GET /gists/:id/star
113100
114101### Response if gist is starred
115102
116- <%= headers 204, : no_response => true %>
103+ <%= headers 204 %>
117104
118105### Response if gist is not starred
119106
120- <%= headers 404, : no_response => true %>
107+ <%= headers 404 %>
121108
122109## Fork a gist
123110
124111 POST /gists/:id/fork
125112
126113### Response
127114
128- <%= headers 201,
129- : Location => "https://api.github.com/users/user/gists/1 " %>
115+ <%= headers 201, : Location => "https://api.github.com/gists/2 " %>
130116<%= json(: gist ) %>
131117
132118## Delete a gist
@@ -135,5 +121,5 @@ The response is identical to [listing a user's gists](#list-a-users-gists).
135121
136122### Response
137123
138- <%= headers 204, : no_response => true %>
124+ <%= headers 204 %>
139125
0 commit comments