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