Commit 43d75960303be538fb79804ca6e2a90241aee0df

Authored by Sebastian Ziebell
2 parents 07f306d8 e76215a3

Merge branch 'feature/api-documentation-fixes' of github.com:Xylakant/gitlabhq into fixes/api

Conflicts:
	doc/api/projects.md
Showing 2 changed files with 35 additions and 14 deletions   Show diff stats
doc/api/README.md
1 1 # GitLab API
2 2  
3   -All API requests require authentication. You need to pass a `private_token` parameter by url or header. You can find or reset your private token in your profile.
  3 +All API requests require authentication. You need to pass a `private_token` parameter by url or header. If passed as header, the header name must be "PRIVATE-TOKEN" (capital and with dash instead of underscore). You can find or reset your private token in your profile.
4 4  
5 5 If no, or an invalid, `private_token` is provided then an error message will be returned with status code 401:
6 6  
... ... @@ -18,6 +18,13 @@ Example of a valid API request:
18 18 GET http://example.com/api/v3/projects?private_token=QVy1PB7sTxfy4pqfZM1U
19 19 ```
20 20  
  21 +Example for a valid API request using curl and authentication via header:
  22 +
  23 +```
  24 +curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" "http://example.com/api/v3/projects"
  25 +```
  26 +
  27 +
21 28 The API uses JSON to serialize data. You don't need to specify `.json` at the end of API URL.
22 29  
23 30 #### Pagination
... ...
doc/api/projects.md
... ... @@ -65,7 +65,8 @@ Return values:
65 65  
66 66 ### Get single project
67 67  
68   -Get a specific project, identified by project ID, which is owned by the authentication user.
  68 +Get a specific project, identified by project ID or NAME, which is owned by the authentication user.
  69 +Currently namespaced projects cannot retrieved by name.
69 70  
70 71 ```
71 72 GET /projects/:id
... ... @@ -73,7 +74,7 @@ GET /projects/:id
73 74  
74 75 Parameters:
75 76  
76   -+ `id` (required) - The ID of a project
  77 ++ `id` (required) - The ID or NAME of a project
77 78  
78 79 ```json
79 80 {
... ... @@ -132,7 +133,20 @@ Return values:
132 133 + `404 Not Found` if something else fails
133 134  
134 135  
135   -### List project members
  136 +## Project access levels
  137 +
  138 +The project access levels are defined in the `user_project` class. Currently, 4
  139 +levels are recoginized:
  140 +
  141 +```
  142 + GUEST = 10
  143 + REPORTER = 20
  144 + DEVELOPER = 30
  145 + MASTER = 40
  146 +```
  147 +
  148 +
  149 +## List project team members
136 150  
137 151 Get a list of project team members.
138 152  
... ... @@ -142,7 +156,7 @@ GET /projects/:id/members
142 156  
143 157 Parameters:
144 158  
145   -+ `id` (required) - The ID of a project
  159 ++ `id` (required) - The ID or NAME of a project
146 160 + `query` - Query string
147 161  
148 162 Return Values:
... ... @@ -163,7 +177,7 @@ GET /projects/:id/members/:user_id
163 177  
164 178 Parameters:
165 179  
166   -+ `id` (required) - The ID of a project
  180 ++ `id` (required) - The ID or NAME of a project
167 181 + `user_id` (required) - The ID of a user
168 182  
169 183 ```json
... ... @@ -196,7 +210,7 @@ POST /projects/:id/members
196 210  
197 211 Parameters:
198 212  
199   -+ `id` (required) - The ID of a project
  213 ++ `id` (required) - The ID or NAME of a project
200 214 + `user_id` (required) - The ID of a user to add
201 215 + `access_level` (required) - Project access level
202 216  
... ... @@ -219,7 +233,7 @@ PUT /projects/:id/members/:user_id
219 233  
220 234 Parameters:
221 235  
222   -+ `id` (required) - The ID of a project
  236 ++ `id` (required) - The ID or NAME of a project
223 237 + `user_id` (required) - The ID of a team member
224 238 + `access_level` (required) - Project access level
225 239  
... ... @@ -242,7 +256,7 @@ DELETE /projects/:id/members/:user_id
242 256  
243 257 Parameters:
244 258  
245   -+ `id` (required) - The ID of a project
  259 ++ `id` (required) - The ID or NAME of a project
246 260 + `user_id` (required) - The ID of a team member
247 261  
248 262 Return Values:
... ... @@ -269,7 +283,7 @@ GET /projects/:id/hooks
269 283  
270 284 Parameters:
271 285  
272   -+ `id` (required) - The ID of a project
  286 ++ `id` (required) - The ID or NAME of a project
273 287  
274 288 Return values:
275 289  
... ... @@ -288,7 +302,7 @@ GET /projects/:id/hooks/:hook_id
288 302  
289 303 Parameters:
290 304  
291   -+ `id` (required) - The ID of a project
  305 ++ `id` (required) - The ID or NAME of a project
292 306 + `hook_id` (required) - The ID of a project hook
293 307  
294 308 ```json
... ... @@ -315,7 +329,7 @@ POST /projects/:id/hooks
315 329  
316 330 Parameters:
317 331  
318   -+ `id` (required) - The ID of a project
  332 ++ `id` (required) - The ID or NAME of a project
319 333 + `url` (required) - The hook URL
320 334  
321 335 Return values:
... ... @@ -336,7 +350,7 @@ PUT /projects/:id/hooks/:hook_id
336 350  
337 351 Parameters:
338 352  
339   -+ `id` (required) - The ID of a project
  353 ++ `id` (required) - The ID or NAME of a project
340 354 + `hook_id` (required) - The ID of a project hook
341 355 + `url` (required) - The hook URL
342 356  
... ... @@ -359,7 +373,7 @@ DELETE /projects/:id/hooks/:hook_id
359 373  
360 374 Parameters:
361 375  
362   -+ `id` (required) - The ID of a project
  376 ++ `id` (required) - The ID or NAME of a project
363 377 + `hook_id` (required) - The ID of hook to delete
364 378  
365 379 Return values:
... ...