Commit 4162566e11d9239d82b532e34c503ad1cbfe4d78
1 parent
13043315
Exists in
master
and in
4 other branches
separate project repositories API docs
Showing
3 changed files
with
177 additions
and
166 deletions
Show diff stats
app/views/help/api.html.haml
@@ -12,6 +12,8 @@ | @@ -12,6 +12,8 @@ | ||
12 | %li | 12 | %li |
13 | = link_to "Snippets", "#snippets", 'data-toggle' => 'tab' | 13 | = link_to "Snippets", "#snippets", 'data-toggle' => 'tab' |
14 | %li | 14 | %li |
15 | + = link_to "Repositories", "#repositories", 'data-toggle' => 'tab' | ||
16 | + %li | ||
15 | = link_to "Users", "#users", 'data-toggle' => 'tab' | 17 | = link_to "Users", "#users", 'data-toggle' => 'tab' |
16 | %li | 18 | %li |
17 | = link_to "Session", "#session", 'data-toggle' => 'tab' | 19 | = link_to "Session", "#session", 'data-toggle' => 'tab' |
@@ -48,6 +50,15 @@ | @@ -48,6 +50,15 @@ | ||
48 | = preserve do | 50 | = preserve do |
49 | = markdown File.read(Rails.root.join("doc", "api", "snippets.md")) | 51 | = markdown File.read(Rails.root.join("doc", "api", "snippets.md")) |
50 | 52 | ||
53 | + .tab-pane#repositories | ||
54 | + .file_holder | ||
55 | + .file_title | ||
56 | + %i.icon-file | ||
57 | + Projects | ||
58 | + .file_content.wiki | ||
59 | + = preserve do | ||
60 | + = markdown File.read(Rails.root.join("doc", "api", "repositories.md")) | ||
61 | + | ||
51 | .tab-pane#users | 62 | .tab-pane#users |
52 | .file_holder | 63 | .file_holder |
53 | .file_title | 64 | .file_title |
doc/api/projects.md
@@ -239,169 +239,3 @@ Parameters: | @@ -239,169 +239,3 @@ Parameters: | ||
239 | + `hook_id` (required) - The ID of hook to delete | 239 | + `hook_id` (required) - The ID of hook to delete |
240 | 240 | ||
241 | Will return status `200 OK` on success, or `404 Not found` on fail. | 241 | Will return status `200 OK` on success, or `404 Not found` on fail. |
242 | - | ||
243 | -## Project repository branches | ||
244 | - | ||
245 | -Get a list of repository branches from a project, sorted by name alphabetically. | ||
246 | - | ||
247 | -``` | ||
248 | -GET /projects/:id/repository/branches | ||
249 | -``` | ||
250 | - | ||
251 | -Parameters: | ||
252 | - | ||
253 | -+ `id` (required) - The ID or code name of a project | ||
254 | - | ||
255 | -```json | ||
256 | -[ | ||
257 | - { | ||
258 | - "name": "master", | ||
259 | - "commit": { | ||
260 | - "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | ||
261 | - "parents": [ | ||
262 | - { | ||
263 | - "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | ||
264 | - } | ||
265 | - ], | ||
266 | - "tree": "46e82de44b1061621357f24c05515327f2795a95", | ||
267 | - "message": "add projects API", | ||
268 | - "author": { | ||
269 | - "name": "John Smith", | ||
270 | - "email": "john@example.com" | ||
271 | - }, | ||
272 | - "committer": { | ||
273 | - "name": "John Smith", | ||
274 | - "email": "john@example.com" | ||
275 | - }, | ||
276 | - "authored_date": "2012-06-27T05:51:39-07:00", | ||
277 | - "committed_date": "2012-06-28T03:44:20-07:00" | ||
278 | - } | ||
279 | - } | ||
280 | -] | ||
281 | -``` | ||
282 | - | ||
283 | -Get a single project repository branch. | ||
284 | - | ||
285 | -``` | ||
286 | -GET /projects/:id/repository/branches/:branch | ||
287 | -``` | ||
288 | - | ||
289 | -Parameters: | ||
290 | - | ||
291 | -+ `id` (required) - The ID or code name of a project | ||
292 | -+ `branch` (required) - The name of the branch | ||
293 | - | ||
294 | -```json | ||
295 | -{ | ||
296 | - "name": "master", | ||
297 | - "commit": { | ||
298 | - "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | ||
299 | - "parents": [ | ||
300 | - { | ||
301 | - "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | ||
302 | - } | ||
303 | - ], | ||
304 | - "tree": "46e82de44b1061621357f24c05515327f2795a95", | ||
305 | - "message": "add projects API", | ||
306 | - "author": { | ||
307 | - "name": "John Smith", | ||
308 | - "email": "john@example.com" | ||
309 | - }, | ||
310 | - "committer": { | ||
311 | - "name": "John Smith", | ||
312 | - "email": "john@example.com" | ||
313 | - }, | ||
314 | - "authored_date": "2012-06-27T05:51:39-07:00", | ||
315 | - "committed_date": "2012-06-28T03:44:20-07:00" | ||
316 | - } | ||
317 | -} | ||
318 | -``` | ||
319 | - | ||
320 | -## Project repository tags | ||
321 | - | ||
322 | -Get a list of repository tags from a project, sorted by name in reverse alphabetical order. | ||
323 | - | ||
324 | -``` | ||
325 | -GET /projects/:id/repository/tags | ||
326 | -``` | ||
327 | - | ||
328 | -Parameters: | ||
329 | - | ||
330 | -+ `id` (required) - The ID or code name of a project | ||
331 | - | ||
332 | -```json | ||
333 | -[ | ||
334 | - { | ||
335 | - "name": "v1.0.0", | ||
336 | - "commit": { | ||
337 | - "id": "2695effb5807a22ff3d138d593fd856244e155e7", | ||
338 | - "parents": [ | ||
339 | - | ||
340 | - ], | ||
341 | - "tree": "38017f2f189336fe4497e9d230c5bb1bf873f08d", | ||
342 | - "message": "Initial commit", | ||
343 | - "author": { | ||
344 | - "name": "John Smith", | ||
345 | - "email": "john@example.com" | ||
346 | - }, | ||
347 | - "committer": { | ||
348 | - "name": "Jack Smith", | ||
349 | - "email": "jack@example.com" | ||
350 | - }, | ||
351 | - "authored_date": "2012-05-28T04:42:42-07:00", | ||
352 | - "committed_date": "2012-05-28T04:42:42-07:00" | ||
353 | - } | ||
354 | - } | ||
355 | -] | ||
356 | -``` | ||
357 | - | ||
358 | -## Project repository commits | ||
359 | - | ||
360 | -Get a list of repository commits in a project. | ||
361 | - | ||
362 | -``` | ||
363 | -GET /projects/:id/repository/commits | ||
364 | -``` | ||
365 | - | ||
366 | -Parameters: | ||
367 | - | ||
368 | -+ `id` (required) - The ID or code name of a project | ||
369 | -+ `ref_name` (optional) - The name of a repository branch or tag | ||
370 | - | ||
371 | -```json | ||
372 | -[ | ||
373 | - { | ||
374 | - "id": "ed899a2f4b50b4370feeea94676502b42383c746", | ||
375 | - "short_id": "ed899a2f4b5", | ||
376 | - "title": "Replace sanitize with escape once", | ||
377 | - "author_name": "Dmitriy Zaporozhets", | ||
378 | - "author_email": "dzaporozhets@sphereconsultinginc.com", | ||
379 | - "created_at": "2012-09-20T11:50:22+03:00" | ||
380 | - }, | ||
381 | - { | ||
382 | - "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6", | ||
383 | - "short_id": "6104942438c", | ||
384 | - "title": "Sanitize for network graph", | ||
385 | - "author_name": "randx", | ||
386 | - "author_email": "dmitriy.zaporozhets@gmail.com", | ||
387 | - "created_at": "2012-09-20T09:06:12+03:00" | ||
388 | - } | ||
389 | -] | ||
390 | -``` | ||
391 | - | ||
392 | -## Raw blob content | ||
393 | - | ||
394 | -Get the raw file contents for a file. | ||
395 | - | ||
396 | -``` | ||
397 | -GET /projects/:id/repository/commits/:sha/blob | ||
398 | -``` | ||
399 | - | ||
400 | -Parameters: | ||
401 | - | ||
402 | -+ `id` (required) - The ID or code name of a project | ||
403 | -+ `sha` (required) - The commit or branch name | ||
404 | -+ `filepath` (required) - The path the file | ||
405 | - | ||
406 | -Will return the raw file contents. | ||
407 | - |
@@ -0,0 +1,166 @@ | @@ -0,0 +1,166 @@ | ||
1 | +## Project repository branches | ||
2 | + | ||
3 | +Get a list of repository branches from a project, sorted by name alphabetically. | ||
4 | + | ||
5 | +``` | ||
6 | +GET /projects/:id/repository/branches | ||
7 | +``` | ||
8 | + | ||
9 | +Parameters: | ||
10 | + | ||
11 | ++ `id` (required) - The ID or code name of a project | ||
12 | + | ||
13 | +```json | ||
14 | +[ | ||
15 | + { | ||
16 | + "name": "master", | ||
17 | + "commit": { | ||
18 | + "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | ||
19 | + "parents": [ | ||
20 | + { | ||
21 | + "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | ||
22 | + } | ||
23 | + ], | ||
24 | + "tree": "46e82de44b1061621357f24c05515327f2795a95", | ||
25 | + "message": "add projects API", | ||
26 | + "author": { | ||
27 | + "name": "John Smith", | ||
28 | + "email": "john@example.com" | ||
29 | + }, | ||
30 | + "committer": { | ||
31 | + "name": "John Smith", | ||
32 | + "email": "john@example.com" | ||
33 | + }, | ||
34 | + "authored_date": "2012-06-27T05:51:39-07:00", | ||
35 | + "committed_date": "2012-06-28T03:44:20-07:00" | ||
36 | + } | ||
37 | + } | ||
38 | +] | ||
39 | +``` | ||
40 | + | ||
41 | +## Project repository branch | ||
42 | + | ||
43 | +Get a single project repository branch. | ||
44 | + | ||
45 | +``` | ||
46 | +GET /projects/:id/repository/branches/:branch | ||
47 | +``` | ||
48 | + | ||
49 | +Parameters: | ||
50 | + | ||
51 | ++ `id` (required) - The ID or code name of a project | ||
52 | ++ `branch` (required) - The name of the branch | ||
53 | + | ||
54 | +```json | ||
55 | +{ | ||
56 | + "name": "master", | ||
57 | + "commit": { | ||
58 | + "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | ||
59 | + "parents": [ | ||
60 | + { | ||
61 | + "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | ||
62 | + } | ||
63 | + ], | ||
64 | + "tree": "46e82de44b1061621357f24c05515327f2795a95", | ||
65 | + "message": "add projects API", | ||
66 | + "author": { | ||
67 | + "name": "John Smith", | ||
68 | + "email": "john@example.com" | ||
69 | + }, | ||
70 | + "committer": { | ||
71 | + "name": "John Smith", | ||
72 | + "email": "john@example.com" | ||
73 | + }, | ||
74 | + "authored_date": "2012-06-27T05:51:39-07:00", | ||
75 | + "committed_date": "2012-06-28T03:44:20-07:00" | ||
76 | + } | ||
77 | +} | ||
78 | +``` | ||
79 | + | ||
80 | +## Project repository tags | ||
81 | + | ||
82 | +Get a list of repository tags from a project, sorted by name in reverse alphabetical order. | ||
83 | + | ||
84 | +``` | ||
85 | +GET /projects/:id/repository/tags | ||
86 | +``` | ||
87 | + | ||
88 | +Parameters: | ||
89 | + | ||
90 | ++ `id` (required) - The ID or code name of a project | ||
91 | + | ||
92 | +```json | ||
93 | +[ | ||
94 | + { | ||
95 | + "name": "v1.0.0", | ||
96 | + "commit": { | ||
97 | + "id": "2695effb5807a22ff3d138d593fd856244e155e7", | ||
98 | + "parents": [ | ||
99 | + | ||
100 | + ], | ||
101 | + "tree": "38017f2f189336fe4497e9d230c5bb1bf873f08d", | ||
102 | + "message": "Initial commit", | ||
103 | + "author": { | ||
104 | + "name": "John Smith", | ||
105 | + "email": "john@example.com" | ||
106 | + }, | ||
107 | + "committer": { | ||
108 | + "name": "Jack Smith", | ||
109 | + "email": "jack@example.com" | ||
110 | + }, | ||
111 | + "authored_date": "2012-05-28T04:42:42-07:00", | ||
112 | + "committed_date": "2012-05-28T04:42:42-07:00" | ||
113 | + } | ||
114 | + } | ||
115 | +] | ||
116 | +``` | ||
117 | + | ||
118 | +## Project repository commits | ||
119 | + | ||
120 | +Get a list of repository commits in a project. | ||
121 | + | ||
122 | +``` | ||
123 | +GET /projects/:id/repository/commits | ||
124 | +``` | ||
125 | + | ||
126 | +Parameters: | ||
127 | + | ||
128 | ++ `id` (required) - The ID or code name of a project | ||
129 | ++ `ref_name` (optional) - The name of a repository branch or tag | ||
130 | + | ||
131 | +```json | ||
132 | +[ | ||
133 | + { | ||
134 | + "id": "ed899a2f4b50b4370feeea94676502b42383c746", | ||
135 | + "short_id": "ed899a2f4b5", | ||
136 | + "title": "Replace sanitize with escape once", | ||
137 | + "author_name": "Dmitriy Zaporozhets", | ||
138 | + "author_email": "dzaporozhets@sphereconsultinginc.com", | ||
139 | + "created_at": "2012-09-20T11:50:22+03:00" | ||
140 | + }, | ||
141 | + { | ||
142 | + "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6", | ||
143 | + "short_id": "6104942438c", | ||
144 | + "title": "Sanitize for network graph", | ||
145 | + "author_name": "randx", | ||
146 | + "author_email": "dmitriy.zaporozhets@gmail.com", | ||
147 | + "created_at": "2012-09-20T09:06:12+03:00" | ||
148 | + } | ||
149 | +] | ||
150 | +``` | ||
151 | + | ||
152 | +## Raw blob content | ||
153 | + | ||
154 | +Get the raw file contents for a file. | ||
155 | + | ||
156 | +``` | ||
157 | +GET /projects/:id/repository/commits/:sha/blob | ||
158 | +``` | ||
159 | + | ||
160 | +Parameters: | ||
161 | + | ||
162 | ++ `id` (required) - The ID or code name of a project | ||
163 | ++ `sha` (required) - The commit or branch name | ||
164 | ++ `filepath` (required) - The path the file | ||
165 | + | ||
166 | +Will return the raw file contents. |