annotate docs/api/api.rst @ 1491:e63a2841714d beta

API docs update
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 29 Sep 2011 03:34:01 +0300
parents ebb90cfdac83
children 256e729a94cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1446
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 .. _api:
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 API
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 ===
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 Starting from RhodeCode version 1.2 a simple API was implemented.
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 There's one schema for calling all api methods. API is implemented
1491
e63a2841714d API docs update
Marcin Kuzminski <marcin@python-works.com>
parents: 1447
diff changeset
10 with JSON protocol both ways. An url to send API request in RhodeCode is
e63a2841714d API docs update
Marcin Kuzminski <marcin@python-works.com>
parents: 1447
diff changeset
11 <your-server>/_admin/api
1446
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 Clients need to send JSON data in such format::
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 {
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 "api_key":"<api_key>",
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 "method":"<method_name>",
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19 "args":{"<arg_key>":"<arg_val>"}
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 }
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22 Simply provide api_key for access and permission validation
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 method is name of method to call
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 and args is an key:value list of arguments to pass to method
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 .. note::
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28 api_key can be found in your user account page
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31 And will receive JSON formatted answer::
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
33 {
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 "result": "<result>",
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35 "error": null
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36 }
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 All responses from API will be `HTTP/1.0 200 OK`, if there's an error while
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39 calling api **error** key from response will contain failure description
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40 and result will be null.
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42 API METHODS
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
43 +++++++++++
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
44
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46 pull
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
47 ----
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
48
1447
ebb90cfdac83 api doc fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1446
diff changeset
49 Pulls given repo from remote location. Can be used to automatically keep
ebb90cfdac83 api doc fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1446
diff changeset
50 remote repos upto date. This command can be executed only using admin users
ebb90cfdac83 api doc fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1446
diff changeset
51 api_key
1446
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
52
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
53 ::
1491
e63a2841714d API docs update
Marcin Kuzminski <marcin@python-works.com>
parents: 1447
diff changeset
54 api_key:"<api_key>"
1446
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
55 method: "pull"
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56 args: {"repo":<repo_name>}
eab0cf9ab8bf API docs
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
57