##// END OF EJS Templates
docs: update API documentation
marcink -
r3495:32c1e2aa default
parent child Browse files
Show More
@@ -0,0 +1,37 b''
1 .. _store-methods-ref:
2
3 store methods
4 =============
5
6 file_store_add (EE only)
7 ------------------------
8
9 .. py:function:: file_store_add(apiuser, filename, content)
10
11 Upload API for the file_store
12
13 Example usage from CLI::
14 rhodecode-api --instance-name=enterprise-1 upload_file "{"content": "$(cat image.jpg | base64)", "filename":"image.jpg"}"
15
16 This command takes the following options:
17
18 :param apiuser: This is filled automatically from the |authtoken|.
19 :type apiuser: AuthUser
20 :param filename: name of the file uploaded
21 :type filename: str
22 :param content: base64 encoded content of the uploaded file
23 :type content: str
24
25 Example output:
26
27 .. code-block:: bash
28
29 id : <id_given_in_input>
30 result: {
31 "access_path": "/_file_store/download/84d156f7-8323-4ad3-9fce-4a8e88e1deaf-0.jpg",
32 "access_path_fqn": "http://server.domain.com/_file_store/download/84d156f7-8323-4ad3-9fce-4a8e88e1deaf-0.jpg",
33 "store_fid": "84d156f7-8323-4ad3-9fce-4a8e88e1deaf-0.jpg"
34 }
35 error : null
36
37
@@ -196,7 +196,8 b' are not required in args.'
196 196 .. --- API DEFS MARKER ---
197 197 .. toctree::
198 198
199 methods/views
199 methods/repo-methods
200 methods/store-methods
200 201 methods/license-methods
201 202 methods/deprecated-methods
202 203 methods/gist-methods
@@ -83,7 +83,7 b' comment_pull_request'
83 83 create_pull_request
84 84 -------------------
85 85
86 .. py:function:: create_pull_request(apiuser, source_repo, target_repo, source_ref, target_ref, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>)
86 .. py:function:: create_pull_request(apiuser, source_repo, target_repo, source_ref, target_ref, owner=<Optional:<OptionalAttr:apiuser>>, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>)
87 87
88 88 Creates a new pull request.
89 89
@@ -104,6 +104,8 b' create_pull_request'
104 104 :type source_ref: str
105 105 :param target_ref: Set the target ref name.
106 106 :type target_ref: str
107 :param owner: user_id or username
108 :type owner: Optional(str)
107 109 :param title: Optionally Set the pull request title, it's generated otherwise
108 110 :type title: str
109 111 :param description: Set the pull request description.
@@ -248,7 +250,7 b' get_pull_request_comments'
248 250 get_pull_requests
249 251 -----------------
250 252
251 .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>)
253 .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>, merge_state=<Optional:True>)
252 254
253 255 Get all pull requests from the repository specified in `repoid`.
254 256
@@ -262,6 +264,9 b' get_pull_requests'
262 264 * ``open``
263 265 * ``closed``
264 266 :type status: str
267 :param merge_state: Optional calculate merge state for each repository.
268 This could result in longer time to fetch the data
269 :type merge_state: bool
265 270
266 271 Example output:
267 272
@@ -356,10 +361,11 b' merge_pull_request'
356 361
357 362 "id": <id_given_in_input>,
358 363 "result": {
359 "executed": "<bool>",
360 "failure_reason": "<int>",
361 "merge_commit_id": "<merge_commit_id>",
362 "possible": "<bool>",
364 "executed": "<bool>",
365 "failure_reason": "<int>",
366 "merge_status_message": "<str>",
367 "merge_commit_id": "<merge_commit_id>",
368 "possible": "<bool>",
363 369 "merge_ref": {
364 370 "commit_id": "<commit_id>",
365 371 "type": "<type>",
@@ -394,15 +394,54 b' get_repo_changesets'
394 394 of changed files.
395 395
396 396
397 get_repo_nodes
398 --------------
397 get_repo_comments
398 -----------------
399
400 .. py:function:: get_repo_comments(apiuser, repoid, commit_id=<Optional:None>, comment_type=<Optional:None>, userid=<Optional:None>)
401
402 Get all comments for a repository
399 403
400 .. py:function:: get_repo_nodes(apiuser, repoid, revision, root_path, ret_type=<Optional:'all'>, details=<Optional:'basic'>, max_file_bytes=<Optional:None>)
404 :param apiuser: This is filled automatically from the |authtoken|.
405 :type apiuser: AuthUser
406 :param repoid: Set the repository name or repository ID.
407 :type repoid: str or int
408 :param commit_id: Optionally filter the comments by the commit_id
409 :type commit_id: Optional(str), default: None
410 :param comment_type: Optionally filter the comments by the comment_type
411 one of: 'note', 'todo'
412 :type comment_type: Optional(str), default: None
413 :param userid: Optionally filter the comments by the author of comment
414 :type userid: Optional(str or int), Default: None
415
416 Example error output:
417
418 .. code-block:: bash
401 419
402 Returns a list of nodes and children in a flat list for a given
403 path at given revision.
420 {
421 "id" : <id_given_in_input>,
422 "result" : [
423 {
424 "comment_author": <USER_DETAILS>,
425 "comment_created_on": "2017-02-01T14:38:16.309",
426 "comment_f_path": "file.txt",
427 "comment_id": 282,
428 "comment_lineno": "n1",
429 "comment_resolved_by": null,
430 "comment_status": [],
431 "comment_text": "This file needs a header",
432 "comment_type": "todo"
433 }
434 ],
435 "error" : null
436 }
404 437
405 It's possible to specify ret_type to show only `files` or `dirs`.
438
439 get_repo_file
440 -------------
441
442 .. py:function:: get_repo_file(apiuser, repoid, commit_id, file_path, max_file_bytes=<Optional:None>, details=<Optional:'basic'>, cache=<Optional:True>)
443
444 Returns a single file from repository at given revision.
406 445
407 446 This command can only be run using an |authtoken| with admin rights,
408 447 or users with at least read rights to |repos|.
@@ -411,37 +450,104 b' get_repo_nodes'
411 450 :type apiuser: AuthUser
412 451 :param repoid: The repository name or repository ID.
413 452 :type repoid: str or int
414 :param revision: The revision for which listing should be done.
415 :type revision: str
416 :param root_path: The path from which to start displaying.
417 :type root_path: str
418 :param ret_type: Set the return type. Valid options are
419 ``all`` (default), ``files`` and ``dirs``.
420 :type ret_type: Optional(str)
421 :param details: Returns extended information about nodes, such as
422 md5, binary, and or content. The valid options are ``basic`` and
423 ``full``.
453 :param commit_id: The revision for which listing should be done.
454 :type commit_id: str
455 :param file_path: The path from which to start displaying.
456 :type file_path: str
457 :param details: Returns different set of information about nodes.
458 The valid options are ``minimal`` ``basic`` and ``full``.
424 459 :type details: Optional(str)
425 460 :param max_file_bytes: Only return file content under this file size bytes
426 :type details: Optional(int)
427
461 :type max_file_bytes: Optional(int)
462 :param cache: Use internal caches for fetching files. If disabled fetching
463 files is slower but more memory efficient
464 :type cache: Optional(bool)
428 465 Example output:
429 466
430 467 .. code-block:: bash
431 468
432 469 id : <id_given_in_input>
433 result: [
434 {
435 "name" : "<name>"
436 "type" : "<type>",
437 "binary": "<true|false>" (only in extended mode)
438 "md5" : "<md5 of file content>" (only in extended mode)
439 },
440 ...
441 ]
470 result: {
471 "binary": false,
472 "extension": "py",
473 "lines": 35,
474 "content": "....",
475 "md5": "76318336366b0f17ee249e11b0c99c41",
476 "mimetype": "text/x-python",
477 "name": "python.py",
478 "size": 817,
479 "type": "file",
480 }
442 481 error: null
443 482
444 483
484 get_repo_fts_tree
485 -----------------
486
487 .. py:function:: get_repo_fts_tree(apiuser, repoid, commit_id, root_path)
488
489 Returns a list of tree nodes for path at given revision. This api is built
490 strictly for usage in full text search building, and shouldn't be consumed
491
492 This command can only be run using an |authtoken| with admin rights,
493 or users with at least read rights to |repos|.
494
495
496 get_repo_nodes
497 --------------
498
499 .. py:function:: get_repo_nodes(apiuser, repoid, revision, root_path, ret_type=<Optional:'all'>, details=<Optional:'basic'>, max_file_bytes=<Optional:None>)
500
501 Returns a list of nodes and children in a flat list for a given
502 path at given revision.
503
504 It's possible to specify ret_type to show only `files` or `dirs`.
505
506 This command can only be run using an |authtoken| with admin rights,
507 or users with at least read rights to |repos|.
508
509 :param apiuser: This is filled automatically from the |authtoken|.
510 :type apiuser: AuthUser
511 :param repoid: The repository name or repository ID.
512 :type repoid: str or int
513 :param revision: The revision for which listing should be done.
514 :type revision: str
515 :param root_path: The path from which to start displaying.
516 :type root_path: str
517 :param ret_type: Set the return type. Valid options are
518 ``all`` (default), ``files`` and ``dirs``.
519 :type ret_type: Optional(str)
520 :param details: Returns extended information about nodes, such as
521 md5, binary, and or content.
522 The valid options are ``basic`` and ``full``.
523 :type details: Optional(str)
524 :param max_file_bytes: Only return file content under this file size bytes
525 :type details: Optional(int)
526
527 Example output:
528
529 .. code-block:: bash
530
531 id : <id_given_in_input>
532 result: [
533 {
534 "binary": false,
535 "content": "File line
536 Line2
537 ",
538 "extension": "md",
539 "lines": 2,
540 "md5": "059fa5d29b19c0657e384749480f6422",
541 "mimetype": "text/x-minidsrc",
542 "name": "file.md",
543 "size": 580,
544 "type": "file"
545 },
546 ...
547 ]
548 error: null
549
550
445 551 get_repo_refs
446 552 -------------
447 553
@@ -103,7 +103,7 b' get_method'
103 103 :param apiuser: This is filled automatically from the |authtoken|.
104 104 :type apiuser: AuthUser
105 105 :param pattern: pattern to match method names against
106 :type older_then: Optional("*")
106 :type pattern: Optional("*")
107 107
108 108 Example output:
109 109
@@ -232,3 +232,37 b' rescan_repos'
232 232 }
233 233
234 234
235 store_exception
236 ---------------
237
238 .. py:function:: store_exception(apiuser, exc_data_json, prefix=<Optional:'rhodecode'>)
239
240 Stores sent exception inside the built-in exception tracker in |RCE| server.
241
242 This command can only be run using an |authtoken| with admin rights to
243 the specified repository.
244
245 This command takes the following options:
246
247 :param apiuser: This is filled automatically from the |authtoken|.
248 :type apiuser: AuthUser
249
250 :param exc_data_json: JSON data with exception e.g
251 {"exc_traceback": "Value `1` is not allowed", "exc_type_name": "ValueError"}
252 :type exc_data_json: JSON data
253
254 :param prefix: prefix for error type, e.g 'rhodecode', 'vcsserver', 'rhodecode-tools'
255 :type prefix: Optional("rhodecode")
256
257 Example output:
258
259 .. code-block:: bash
260
261 id : <id_given_in_input>
262 "result": {
263 "exc_id": 139718459226384,
264 "exc_url": "http://localhost:8080/_admin/settings/exceptions/139718459226384"
265 }
266 error : null
267
268
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now