comparison docs/api/api.rst @ 1879:702e29ce1e9b

backporting #329 into stable
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 21 Dec 2011 02:05:31 +0200
parents 8628c8706bf8
children 466292e57bfd
comparison
equal deleted inserted replaced
1732:8355c17fb6aa 1879:702e29ce1e9b
9 There's a single schema for calling all api methods. API is implemented 9 There's a single schema for calling all api methods. API is implemented
10 with JSON protocol both ways. An url to send API request in RhodeCode is 10 with JSON protocol both ways. An url to send API request in RhodeCode is
11 <your_server>/_admin/api 11 <your_server>/_admin/api
12 12
13 13
14 All clients need to send JSON data in such format:: 14 All clients are required to send JSON-RPC spec JSON data::
15 15
16 { 16 {
17 "api_key":"<api_key>", 17 "api_key":"<api_key>",
18 "method":"<method_name>", 18 "method":"<method_name>",
19 "args":{"<arg_key>":"<arg_val>"} 19 "args":{"<arg_key>":"<arg_val>"}
30 .. note:: 30 .. note::
31 31
32 api_key can be found in your user account page 32 api_key can be found in your user account page
33 33
34 34
35 RhodeCode API will return always a JSON formatted answer:: 35 RhodeCode API will return always a JSON-RPC response::
36 36
37 { 37 {
38 "result": "<result>", 38 "result": "<result>",
39 "error": null 39 "error": null
40 } 40 }
218 "id": "<newusersgroupid>", 218 "id": "<newusersgroupid>",
219 "msg": "created new users group <name>" 219 "msg": "created new users group <name>"
220 } 220 }
221 error: null 221 error: null
222 222
223 add_user_to_users_groups 223 add_user_to_users_group
224 ------------------------ 224 -----------------------
225 225
226 Adds a user to a users group. This command can be executed only using api_key 226 Adds a user to a users group. This command can be executed only using api_key
227 belonging to user with admin rights 227 belonging to user with admin rights
228 228
229 INPUT:: 229 INPUT::
297 "lastname" : "<lastname>", 297 "lastname" : "<lastname>",
298 "email" : "<email>", 298 "email" : "<email>",
299 "active" : "<bool>", 299 "active" : "<bool>",
300 "admin" :  "<bool>", 300 "admin" :  "<bool>",
301 "ldap" : "<ldap_dn>", 301 "ldap" : "<ldap_dn>",
302 "permission" : "repository_(read|write|admin)" 302 "permission" : "repository.(read|write|admin)"
303 }, 303 },
304 304
305 { 305 {
306 "id" : "<usersgroupid>", 306 "id" : "<usersgroupid>",
307 "name" : "<usersgroupname>", 307 "name" : "<usersgroupname>",
308 "active": "<bool>", 308 "active": "<bool>",
309 "permission" : "repository_(read|write|admin)" 309 "permission" : "repository.(read|write|admin)"
310 }, 310 },
311 311
312 ] 312 ]
313 } 313 }
314 error: null 314 error: null
351 api_key : "<api_key>" 351 api_key : "<api_key>"
352 method : "add_user_to_repo" 352 method : "add_user_to_repo"
353 args: { 353 args: {
354 "repo_name" : "<reponame>", 354 "repo_name" : "<reponame>",
355 "user_name" : "<username>", 355 "user_name" : "<username>",
356 "perm" : "(None|repository_(read|write|admin))", 356 "perm" : "(None|repository.(read|write|admin))",
357 } 357 }
358 358
359 OUTPUT:: 359 OUTPUT::
360 360
361 result: None 361 result: None
362 error: null 362 error: null
363
364 add_users_group_to_repo
365 -----------------------
366
367 Add a users group to a repository. This command can be executed only using
368 api_key belonging to user with admin rights. If "perm" is None, group will
369 be removed from the repository.
370
371 INPUT::
372
373 api_key : "<api_key>"
374 method : "add_users_group_to_repo"
375 args: {
376 "repo_name" : "<reponame>",
377 "group_name" : "<groupname>",
378 "perm" : "(None|repository.(read|write|admin))",
379 }