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