comparison docs/api/api.rst @ 2165:dc2584ba5fbc

merged beta into default branch
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 28 Mar 2012 19:54:16 +0200
parents 934906f028b5 12ceeda33339
children 63e58ef80ef1
comparison
equal deleted inserted replaced
2097:8fd6650bb436 2165:dc2584ba5fbc
25 ++++++++++ 25 ++++++++++
26 26
27 All clients are required to send JSON-RPC spec JSON data:: 27 All clients are required to send JSON-RPC spec JSON data::
28 28
29 { 29 {
30 "id:<id>, 30 "id:"<id>",
31 "api_key":"<api_key>", 31 "api_key":"<api_key>",
32 "method":"<method_name>", 32 "method":"<method_name>",
33 "args":{"<arg_key>":"<arg_val>"} 33 "args":{"<arg_key>":"<arg_val>"}
34 } 34 }
35 35
48 48
49 49
50 RhodeCode API will return always a JSON-RPC response:: 50 RhodeCode API will return always a JSON-RPC response::
51 51
52 { 52 {
53 "id":<id>, 53 "id":<id>, # matching id sent by request
54 "result": "<result>", 54 "result": "<result>"|null, # JSON formatted result, null if any errors
55 "error": null 55 "error": "null"|<error_message> # JSON formatted error (if any)
56 } 56 }
57 57
58 All responses from API will be `HTTP/1.0 200 OK`, if there's an error while 58 All responses from API will be `HTTP/1.0 200 OK`, if there's an error while
59 calling api *error* key from response will contain failure description 59 calling api *error* key from response will contain failure description
60 and result will be null. 60 and result will be null.
70 remote repos up to date. This command can be executed only using api_key 70 remote repos up to date. This command can be executed only using api_key
71 belonging to user with admin rights 71 belonging to user with admin rights
72 72
73 INPUT:: 73 INPUT::
74 74
75 id : <id_for_response>
75 api_key : "<api_key>" 76 api_key : "<api_key>"
76 method : "pull" 77 method : "pull"
77 args : { 78 args : {
78 "repo_name" : "<reponame>" 79 "repo_name" : "<reponame>"
79 } 80 }
92 rights. 93 rights.
93 94
94 95
95 INPUT:: 96 INPUT::
96 97
98 id : <id_for_response>
97 api_key : "<api_key>" 99 api_key : "<api_key>"
98 method : "get_user" 100 method : "get_user"
99 args : { 101 args : {
100 "userid" : "<username or user_id>" 102 "userid" : "<username or user_id>"
101 } 103 }
109 "firstname": "<firstname>", 111 "firstname": "<firstname>",
110 "lastname" : "<lastname>", 112 "lastname" : "<lastname>",
111 "email" : "<email>", 113 "email" : "<email>",
112 "active" : "<bool>", 114 "active" : "<bool>",
113 "admin" :  "<bool>", 115 "admin" :  "<bool>",
114 "ldap_dn" : "<ldap_dn>" 116 "ldap_dn" : "<ldap_dn>",
117 "last_login": "<last_login>",
118 "permissions": {
119 "global": ["hg.create.repository",
120 "repository.read",
121 "hg.register.manual_activate"],
122 "repositories": {"repo1": "repository.none"},
123 "repositories_groups": {"Group1": "group.read"}
124 },
115 } 125 }
116 126
117 error: null 127 error: null
118 128
119 129
124 belonging to user with admin rights. 134 belonging to user with admin rights.
125 135
126 136
127 INPUT:: 137 INPUT::
128 138
139 id : <id_for_response>
129 api_key : "<api_key>" 140 api_key : "<api_key>"
130 method : "get_users" 141 method : "get_users"
131 args : { } 142 args : { }
132 143
133 OUTPUT:: 144 OUTPUT::
139 "firstname": "<firstname>", 150 "firstname": "<firstname>",
140 "lastname" : "<lastname>", 151 "lastname" : "<lastname>",
141 "email" : "<email>", 152 "email" : "<email>",
142 "active" : "<bool>", 153 "active" : "<bool>",
143 "admin" :  "<bool>", 154 "admin" :  "<bool>",
144 "ldap_dn" : "<ldap_dn>" 155 "ldap_dn" : "<ldap_dn>",
156 "last_login": "<last_login>",
145 }, 157 },
146 158
147 ] 159 ]
148 error: null 160 error: null
149 161
155 be executed only using api_key belonging to user with admin rights. 167 be executed only using api_key belonging to user with admin rights.
156 168
157 169
158 INPUT:: 170 INPUT::
159 171
172 id : <id_for_response>
160 api_key : "<api_key>" 173 api_key : "<api_key>"
161 method : "create_user" 174 method : "create_user"
162 args : { 175 args : {
163 "username" : "<username>", 176 "username" : "<username>",
164 "password" : "<password>", 177 "password" : "<password>",
186 be executed only using api_key belonging to user with admin rights. 199 be executed only using api_key belonging to user with admin rights.
187 200
188 201
189 INPUT:: 202 INPUT::
190 203
204 id : <id_for_response>
191 api_key : "<api_key>" 205 api_key : "<api_key>"
192 method : "update_user" 206 method : "update_user"
193 args : { 207 args : {
194 "userid" : "<user_id or username>", 208 "userid" : "<user_id or username>",
195 "username" : "<username>", 209 "username" : "<username>",
218 belonging to user with admin rights. 232 belonging to user with admin rights.
219 233
220 234
221 INPUT:: 235 INPUT::
222 236
237 id : <id_for_response>
223 api_key : "<api_key>" 238 api_key : "<api_key>"
224 method : "get_users_group" 239 method : "get_users_group"
225 args : { 240 args : {
226 "group_name" : "<name>" 241 "group_name" : "<name>"
227 } 242 }
256 api_key belonging to user with admin rights. 271 api_key belonging to user with admin rights.
257 272
258 273
259 INPUT:: 274 INPUT::
260 275
276 id : <id_for_response>
261 api_key : "<api_key>" 277 api_key : "<api_key>"
262 method : "get_users_groups" 278 method : "get_users_groups"
263 args : { } 279 args : { }
264 280
265 OUTPUT:: 281 OUTPUT::
294 belonging to user with admin rights 310 belonging to user with admin rights
295 311
296 312
297 INPUT:: 313 INPUT::
298 314
315 id : <id_for_response>
299 api_key : "<api_key>" 316 api_key : "<api_key>"
300 method : "create_users_group" 317 method : "create_users_group"
301 args: { 318 args: {
302 "group_name": "<groupname>", 319 "group_name": "<groupname>",
303 "active":"<bool> = True" 320 "active":"<bool> = True"
320 belonging to user with admin rights 337 belonging to user with admin rights
321 338
322 339
323 INPUT:: 340 INPUT::
324 341
342 id : <id_for_response>
325 api_key : "<api_key>" 343 api_key : "<api_key>"
326 method : "add_user_users_group" 344 method : "add_user_users_group"
327 args: { 345 args: {
328 "group_name" : "<groupname>", 346 "group_name" : "<groupname>",
329 "username" : "<username>" 347 "username" : "<username>"
348 using api_key belonging to user with admin rights 366 using api_key belonging to user with admin rights
349 367
350 368
351 INPUT:: 369 INPUT::
352 370
371 id : <id_for_response>
353 api_key : "<api_key>" 372 api_key : "<api_key>"
354 method : "remove_user_from_users_group" 373 method : "remove_user_from_users_group"
355 args: { 374 args: {
356 "group_name" : "<groupname>", 375 "group_name" : "<groupname>",
357 "username" : "<username>" 376 "username" : "<username>"
368 387
369 388
370 get_repo 389 get_repo
371 -------- 390 --------
372 391
373 Gets an existing repository by it's name or repository_id. This command can 392 Gets an existing repository by it's name or repository_id. Members will return
393 either users_group or user associated to that repository. This command can
374 be executed only using api_key belonging to user with admin rights. 394 be executed only using api_key belonging to user with admin rights.
375 395
376 396
377 INPUT:: 397 INPUT::
378 398
399 id : <id_for_response>
379 api_key : "<api_key>" 400 api_key : "<api_key>"
380 method : "get_repo" 401 method : "get_repo"
381 args: { 402 args: {
382 "repoid" : "<reponame or repo_id>" 403 "repoid" : "<reponame or repo_id>"
383 } 404 }
389 "id" : "<id>", 410 "id" : "<id>",
390 "repo_name" : "<reponame>" 411 "repo_name" : "<reponame>"
391 "type" : "<type>", 412 "type" : "<type>",
392 "description" : "<description>", 413 "description" : "<description>",
393 "members" : [ 414 "members" : [
394 { "id" : "<userid>", 415 {
416 "type": "user",
417 "id" : "<userid>",
395 "username" : "<username>", 418 "username" : "<username>",
396 "firstname": "<firstname>", 419 "firstname": "<firstname>",
397 "lastname" : "<lastname>", 420 "lastname" : "<lastname>",
398 "email" : "<email>", 421 "email" : "<email>",
399 "active" : "<bool>", 422 "active" : "<bool>",
400 "admin" :  "<bool>", 423 "admin" :  "<bool>",
401 "ldap" : "<ldap_dn>", 424 "ldap" : "<ldap_dn>",
402 "permission" : "repository.(read|write|admin)" 425 "permission" : "repository.(read|write|admin)"
403 }, 426 },
404 427
405 { 428 {
429 "type": "users_group",
406 "id" : "<usersgroupid>", 430 "id" : "<usersgroupid>",
407 "name" : "<usersgroupname>", 431 "name" : "<usersgroupname>",
408 "active": "<bool>", 432 "active": "<bool>",
409 "permission" : "repository.(read|write|admin)" 433 "permission" : "repository.(read|write|admin)"
410 }, 434 },
421 belonging to user with admin rights 445 belonging to user with admin rights
422 446
423 447
424 INPUT:: 448 INPUT::
425 449
450 id : <id_for_response>
426 api_key : "<api_key>" 451 api_key : "<api_key>"
427 method : "get_repos" 452 method : "get_repos"
428 args: { } 453 args: { }
429 454
430 OUTPUT:: 455 OUTPUT::
450 with admin rights 475 with admin rights
451 476
452 477
453 INPUT:: 478 INPUT::
454 479
480 id : <id_for_response>
455 api_key : "<api_key>" 481 api_key : "<api_key>"
456 method : "get_repo_nodes" 482 method : "get_repo_nodes"
457 args: { 483 args: {
458 "repo_name" : "<reponame>", 484 "repo_name" : "<reponame>",
459 "revision" : "<revision>", 485 "revision" : "<revision>",
483 and create "baz" repository with "bar" as group. 509 and create "baz" repository with "bar" as group.
484 510
485 511
486 INPUT:: 512 INPUT::
487 513
514 id : <id_for_response>
488 api_key : "<api_key>" 515 api_key : "<api_key>"
489 method : "create_repo" 516 method : "create_repo"
490 args: { 517 args: {
491 "repo_name" : "<reponame>", 518 "repo_name" : "<reponame>",
492 "owner_name" : "<ownername>", 519 "owner_name" : "<ownername>",
512 belonging to user with admin rights. 539 belonging to user with admin rights.
513 540
514 541
515 INPUT:: 542 INPUT::
516 543
544 id : <id_for_response>
517 api_key : "<api_key>" 545 api_key : "<api_key>"
518 method : "delete_repo" 546 method : "delete_repo"
519 args: { 547 args: {
520 "repo_name" : "<reponame>", 548 "repo_name" : "<reponame>",
521 } 549 }
536 with admin rights. 564 with admin rights.
537 565
538 566
539 INPUT:: 567 INPUT::
540 568
569 id : <id_for_response>
541 api_key : "<api_key>" 570 api_key : "<api_key>"
542 method : "grant_user_permission" 571 method : "grant_user_permission"
543 args: { 572 args: {
544 "repo_name" : "<reponame>", 573 "repo_name" : "<reponame>",
545 "username" : "<username>", 574 "username" : "<username>",
561 only using api_key belonging to user with admin rights. 590 only using api_key belonging to user with admin rights.
562 591
563 592
564 INPUT:: 593 INPUT::
565 594
595 id : <id_for_response>
566 api_key : "<api_key>" 596 api_key : "<api_key>"
567 method : "revoke_user_permission" 597 method : "revoke_user_permission"
568 args: { 598 args: {
569 "repo_name" : "<reponame>", 599 "repo_name" : "<reponame>",
570 "username" : "<username>", 600 "username" : "<username>",
586 api_key belonging to user with admin rights. 616 api_key belonging to user with admin rights.
587 617
588 618
589 INPUT:: 619 INPUT::
590 620
621 id : <id_for_response>
591 api_key : "<api_key>" 622 api_key : "<api_key>"
592 method : "grant_users_group_permission" 623 method : "grant_users_group_permission"
593 args: { 624 args: {
594 "repo_name" : "<reponame>", 625 "repo_name" : "<reponame>",
595 "group_name" : "<usersgroupname>", 626 "group_name" : "<usersgroupname>",
610 Revoke permission for users group on given repository.This command can be 641 Revoke permission for users group on given repository.This command can be
611 executed only using api_key belonging to user with admin rights. 642 executed only using api_key belonging to user with admin rights.
612 643
613 INPUT:: 644 INPUT::
614 645
646 id : <id_for_response>
615 api_key : "<api_key>" 647 api_key : "<api_key>"
616 method : "revoke_users_group_permission" 648 method : "revoke_users_group_permission"
617 args: { 649 args: {
618 "repo_name" : "<reponame>", 650 "repo_name" : "<reponame>",
619 "users_group" : "<usersgroupname>", 651 "users_group" : "<usersgroupname>",