Show More
@@ -1,986 +1,1001 b'' | |||||
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 a single schema for calling all api methods. API is implemented |
|
9 | There's a single schema for calling all api methods. API is implemented | |
10 | with JSON protocol both ways. An url to send API request to RhodeCode is |
|
10 | with JSON protocol both ways. An url to send API request to RhodeCode is | |
11 | <your_server>/_admin/api |
|
11 | <your_server>/_admin/api | |
12 |
|
12 | |||
13 | API ACCESS FOR WEB VIEWS |
|
13 | API ACCESS FOR WEB VIEWS | |
14 | ++++++++++++++++++++++++ |
|
14 | ++++++++++++++++++++++++ | |
15 |
|
15 | |||
16 | API access can also be turned on for each web view in RhodeCode that is |
|
16 | API access can also be turned on for each web view in RhodeCode that is | |
17 | decorated with `@LoginRequired` decorator. To enable API access simple change |
|
17 | decorated with `@LoginRequired` decorator. To enable API access simple change | |
18 | the standard login decorator to `@LoginRequired(api_access=True)`. |
|
18 | the standard login decorator to `@LoginRequired(api_access=True)`. | |
|
19 | ||||
|
20 | To make this operation easier, starting from version 1.7.0 there's a white list | |||
|
21 | of views that will have API access enabled. Simply edit `api_access_controllers_whitelist` | |||
|
22 | option in your .ini file, and define views that should have API access enabled. | |||
|
23 | Following example shows how to enable API access to patch/diff raw file and archive | |||
|
24 | in RhodeCode:: | |||
|
25 | ||||
|
26 | api_access_controllers_whitelist = | |||
|
27 | ChangesetController:changeset_patch, | |||
|
28 | ChangesetController:changeset_raw, | |||
|
29 | FilesController:raw, | |||
|
30 | FilesController:archivefile | |||
|
31 | ||||
|
32 | ||||
19 | After this change, a rhodecode view can be accessed without login by adding a |
|
33 | After this change, a rhodecode view can be accessed without login by adding a | |
20 | GET parameter `?api_key=<api_key>` to url. By default this is only |
|
34 | GET parameter `?api_key=<api_key>` to url. By default this is only | |
21 | enabled on RSS/ATOM feed views. |
|
35 | enabled on RSS/ATOM feed views. Exposing raw diffs is a good way to integrate with | |
|
36 | 3rd party services like code review, or build farms that could download archives. | |||
22 |
|
37 | |||
23 |
|
38 | |||
24 | API ACCESS |
|
39 | API ACCESS | |
25 | ++++++++++ |
|
40 | ++++++++++ | |
26 |
|
41 | |||
27 | All clients are required to send JSON-RPC spec JSON data:: |
|
42 | All clients are required to send JSON-RPC spec JSON data:: | |
28 |
|
43 | |||
29 | { |
|
44 | { | |
30 | "id:"<id>", |
|
45 | "id:"<id>", | |
31 | "api_key":"<api_key>", |
|
46 | "api_key":"<api_key>", | |
32 | "method":"<method_name>", |
|
47 | "method":"<method_name>", | |
33 | "args":{"<arg_key>":"<arg_val>"} |
|
48 | "args":{"<arg_key>":"<arg_val>"} | |
34 | } |
|
49 | } | |
35 |
|
50 | |||
36 | Example call for autopulling remotes repos using curl:: |
|
51 | Example call for autopulling remotes repos using curl:: | |
37 | curl https://server.com/_admin/api -X POST -H 'content-type:text/plain' --data-binary '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repo":"CPython"}}' |
|
52 | curl https://server.com/_admin/api -X POST -H 'content-type:text/plain' --data-binary '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repo":"CPython"}}' | |
38 |
|
53 | |||
39 | Simply provide |
|
54 | Simply provide | |
40 | - *id* A value of any type, which is used to match the response with the request that it is replying to. |
|
55 | - *id* A value of any type, which is used to match the response with the request that it is replying to. | |
41 | - *api_key* for access and permission validation. |
|
56 | - *api_key* for access and permission validation. | |
42 | - *method* is name of method to call |
|
57 | - *method* is name of method to call | |
43 | - *args* is an key:value list of arguments to pass to method |
|
58 | - *args* is an key:value list of arguments to pass to method | |
44 |
|
59 | |||
45 | .. note:: |
|
60 | .. note:: | |
46 |
|
61 | |||
47 | api_key can be found in your user account page |
|
62 | api_key can be found in your user account page | |
48 |
|
63 | |||
49 |
|
64 | |||
50 | RhodeCode API will return always a JSON-RPC response:: |
|
65 | RhodeCode API will return always a JSON-RPC response:: | |
51 |
|
66 | |||
52 | { |
|
67 | { | |
53 | "id":<id>, # matching id sent by request |
|
68 | "id":<id>, # matching id sent by request | |
54 | "result": "<result>"|null, # JSON formatted result, null if any errors |
|
69 | "result": "<result>"|null, # JSON formatted result, null if any errors | |
55 | "error": "null"|<error_message> # JSON formatted error (if any) |
|
70 | "error": "null"|<error_message> # JSON formatted error (if any) | |
56 | } |
|
71 | } | |
57 |
|
72 | |||
58 | All responses from API will be `HTTP/1.0 200 OK`, if there's an error while |
|
73 | 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 |
|
74 | calling api *error* key from response will contain failure description | |
60 | and result will be null. |
|
75 | and result will be null. | |
61 |
|
76 | |||
62 |
|
77 | |||
63 | API CLIENT |
|
78 | API CLIENT | |
64 | ++++++++++ |
|
79 | ++++++++++ | |
65 |
|
80 | |||
66 | From version 1.4 RhodeCode adds a script that allows to easily |
|
81 | From version 1.4 RhodeCode adds a script that allows to easily | |
67 | communicate with API. After installing RhodeCode a `rhodecode-api` script |
|
82 | communicate with API. After installing RhodeCode a `rhodecode-api` script | |
68 | will be available. |
|
83 | will be available. | |
69 |
|
84 | |||
70 | To get started quickly simply run:: |
|
85 | To get started quickly simply run:: | |
71 |
|
86 | |||
72 | rhodecode-api _create_config --apikey=<youapikey> --apihost=<rhodecode host> |
|
87 | rhodecode-api _create_config --apikey=<youapikey> --apihost=<rhodecode host> | |
73 |
|
88 | |||
74 | This will create a file named .config in the directory you executed it storing |
|
89 | This will create a file named .config in the directory you executed it storing | |
75 | json config file with credentials. You can skip this step and always provide |
|
90 | json config file with credentials. You can skip this step and always provide | |
76 | both of the arguments to be able to communicate with server |
|
91 | both of the arguments to be able to communicate with server | |
77 |
|
92 | |||
78 |
|
93 | |||
79 | after that simply run any api command for example get_repo:: |
|
94 | after that simply run any api command for example get_repo:: | |
80 |
|
95 | |||
81 | rhodecode-api get_repo |
|
96 | rhodecode-api get_repo | |
82 |
|
97 | |||
83 | calling {"api_key": "<apikey>", "id": 75, "args": {}, "method": "get_repo"} to http://127.0.0.1:5000 |
|
98 | calling {"api_key": "<apikey>", "id": 75, "args": {}, "method": "get_repo"} to http://127.0.0.1:5000 | |
84 | rhodecode said: |
|
99 | rhodecode said: | |
85 | {'error': 'Missing non optional `repoid` arg in JSON DATA', |
|
100 | {'error': 'Missing non optional `repoid` arg in JSON DATA', | |
86 | 'id': 75, |
|
101 | 'id': 75, | |
87 | 'result': None} |
|
102 | 'result': None} | |
88 |
|
103 | |||
89 | Ups looks like we forgot to add an argument |
|
104 | Ups looks like we forgot to add an argument | |
90 |
|
105 | |||
91 | Let's try again now giving the repoid as parameters:: |
|
106 | Let's try again now giving the repoid as parameters:: | |
92 |
|
107 | |||
93 | rhodecode-api get_repo repoid:rhodecode |
|
108 | rhodecode-api get_repo repoid:rhodecode | |
94 |
|
109 | |||
95 | calling {"api_key": "<apikey>", "id": 39, "args": {"repoid": "rhodecode"}, "method": "get_repo"} to http://127.0.0.1:5000 |
|
110 | calling {"api_key": "<apikey>", "id": 39, "args": {"repoid": "rhodecode"}, "method": "get_repo"} to http://127.0.0.1:5000 | |
96 | rhodecode said: |
|
111 | rhodecode said: | |
97 | {'error': None, |
|
112 | {'error': None, | |
98 | 'id': 39, |
|
113 | 'id': 39, | |
99 | 'result': <json data...>} |
|
114 | 'result': <json data...>} | |
100 |
|
115 | |||
101 |
|
116 | |||
102 |
|
117 | |||
103 | API METHODS |
|
118 | API METHODS | |
104 | +++++++++++ |
|
119 | +++++++++++ | |
105 |
|
120 | |||
106 |
|
121 | |||
107 | pull |
|
122 | pull | |
108 | ---- |
|
123 | ---- | |
109 |
|
124 | |||
110 | Pulls given repo from remote location. Can be used to automatically keep |
|
125 | Pulls given repo from remote location. Can be used to automatically keep | |
111 | remote repos up to date. This command can be executed only using api_key |
|
126 | remote repos up to date. This command can be executed only using api_key | |
112 | belonging to user with admin rights |
|
127 | belonging to user with admin rights | |
113 |
|
128 | |||
114 | INPUT:: |
|
129 | INPUT:: | |
115 |
|
130 | |||
116 | id : <id_for_response> |
|
131 | id : <id_for_response> | |
117 | api_key : "<api_key>" |
|
132 | api_key : "<api_key>" | |
118 | method : "pull" |
|
133 | method : "pull" | |
119 | args : { |
|
134 | args : { | |
120 | "repoid" : "<reponame or repo_id>" |
|
135 | "repoid" : "<reponame or repo_id>" | |
121 | } |
|
136 | } | |
122 |
|
137 | |||
123 | OUTPUT:: |
|
138 | OUTPUT:: | |
124 |
|
139 | |||
125 | id : <id_given_in_input> |
|
140 | id : <id_given_in_input> | |
126 | result : "Pulled from `<reponame>`" |
|
141 | result : "Pulled from `<reponame>`" | |
127 | error : null |
|
142 | error : null | |
128 |
|
143 | |||
129 |
|
144 | |||
130 | rescan_repos |
|
145 | rescan_repos | |
131 | ------------ |
|
146 | ------------ | |
132 |
|
147 | |||
133 | Dispatch rescan repositories action. If remove_obsolete is set |
|
148 | Dispatch rescan repositories action. If remove_obsolete is set | |
134 | RhodeCode will delete repos that are in database but not in the filesystem. |
|
149 | RhodeCode will delete repos that are in database but not in the filesystem. | |
135 | This command can be executed only using api_key belonging to user with admin |
|
150 | This command can be executed only using api_key belonging to user with admin | |
136 | rights. |
|
151 | rights. | |
137 |
|
152 | |||
138 | INPUT:: |
|
153 | INPUT:: | |
139 |
|
154 | |||
140 | id : <id_for_response> |
|
155 | id : <id_for_response> | |
141 | api_key : "<api_key>" |
|
156 | api_key : "<api_key>" | |
142 | method : "rescan_repos" |
|
157 | method : "rescan_repos" | |
143 | args : { |
|
158 | args : { | |
144 | "remove_obsolete" : "<boolean = Optional(False)>" |
|
159 | "remove_obsolete" : "<boolean = Optional(False)>" | |
145 | } |
|
160 | } | |
146 |
|
161 | |||
147 | OUTPUT:: |
|
162 | OUTPUT:: | |
148 |
|
163 | |||
149 | id : <id_given_in_input> |
|
164 | id : <id_given_in_input> | |
150 | result : "{'added': [<list of names of added repos>], |
|
165 | result : "{'added': [<list of names of added repos>], | |
151 | 'removed': [<list of names of removed repos>]}" |
|
166 | 'removed': [<list of names of removed repos>]}" | |
152 | error : null |
|
167 | error : null | |
153 |
|
168 | |||
154 |
|
169 | |||
155 | invalidate_cache |
|
170 | invalidate_cache | |
156 | ---------------- |
|
171 | ---------------- | |
157 |
|
172 | |||
158 | Invalidate cache for repository. |
|
173 | Invalidate cache for repository. | |
159 | This command can be executed only using api_key belonging to user with admin |
|
174 | This command can be executed only using api_key belonging to user with admin | |
160 | rights or regular user that have write or admin or write access to repository. |
|
175 | rights or regular user that have write or admin or write access to repository. | |
161 |
|
176 | |||
162 | INPUT:: |
|
177 | INPUT:: | |
163 |
|
178 | |||
164 | id : <id_for_response> |
|
179 | id : <id_for_response> | |
165 | api_key : "<api_key>" |
|
180 | api_key : "<api_key>" | |
166 | method : "invalidate_cache" |
|
181 | method : "invalidate_cache" | |
167 | args : { |
|
182 | args : { | |
168 | "repoid" : "<reponame or repo_id>" |
|
183 | "repoid" : "<reponame or repo_id>" | |
169 | } |
|
184 | } | |
170 |
|
185 | |||
171 | OUTPUT:: |
|
186 | OUTPUT:: | |
172 |
|
187 | |||
173 | id : <id_given_in_input> |
|
188 | id : <id_given_in_input> | |
174 | result : "Caches of repository `<reponame>`" |
|
189 | result : "Caches of repository `<reponame>`" | |
175 | error : null |
|
190 | error : null | |
176 |
|
191 | |||
177 | lock |
|
192 | lock | |
178 | ---- |
|
193 | ---- | |
179 |
|
194 | |||
180 | Set locking state on given repository by given user. If userid param is skipped |
|
195 | Set locking state on given repository by given user. If userid param is skipped | |
181 | , then it is set to id of user whos calling this method. If locked param is skipped |
|
196 | , then it is set to id of user whos calling this method. If locked param is skipped | |
182 | then function shows current lock state of given repo. |
|
197 | then function shows current lock state of given repo. | |
183 | This command can be executed only using api_key belonging to user with admin |
|
198 | This command can be executed only using api_key belonging to user with admin | |
184 | rights or regular user that have admin or write access to repository. |
|
199 | rights or regular user that have admin or write access to repository. | |
185 |
|
200 | |||
186 | INPUT:: |
|
201 | INPUT:: | |
187 |
|
202 | |||
188 | id : <id_for_response> |
|
203 | id : <id_for_response> | |
189 | api_key : "<api_key>" |
|
204 | api_key : "<api_key>" | |
190 | method : "lock" |
|
205 | method : "lock" | |
191 | args : { |
|
206 | args : { | |
192 | "repoid" : "<reponame or repo_id>" |
|
207 | "repoid" : "<reponame or repo_id>" | |
193 | "userid" : "<user_id or username = Optional(=apiuser)>", |
|
208 | "userid" : "<user_id or username = Optional(=apiuser)>", | |
194 | "locked" : "<bool true|false = Optional(=None)>" |
|
209 | "locked" : "<bool true|false = Optional(=None)>" | |
195 | } |
|
210 | } | |
196 |
|
211 | |||
197 | OUTPUT:: |
|
212 | OUTPUT:: | |
198 |
|
213 | |||
199 | id : <id_given_in_input> |
|
214 | id : <id_given_in_input> | |
200 | result : "User `<username>` set lock state for repo `<reponame>` to `true|false`" |
|
215 | result : "User `<username>` set lock state for repo `<reponame>` to `true|false`" | |
201 | error : null |
|
216 | error : null | |
202 |
|
217 | |||
203 |
|
218 | |||
204 | show_ip |
|
219 | show_ip | |
205 | ------- |
|
220 | ------- | |
206 |
|
221 | |||
207 | Shows IP address as seen from RhodeCode server, together with all |
|
222 | Shows IP address as seen from RhodeCode server, together with all | |
208 | defined IP addresses for given user. |
|
223 | defined IP addresses for given user. | |
209 | This command can be executed only using api_key belonging to user with admin |
|
224 | This command can be executed only using api_key belonging to user with admin | |
210 | rights. |
|
225 | rights. | |
211 |
|
226 | |||
212 | INPUT:: |
|
227 | INPUT:: | |
213 |
|
228 | |||
214 | id : <id_for_response> |
|
229 | id : <id_for_response> | |
215 | api_key : "<api_key>" |
|
230 | api_key : "<api_key>" | |
216 | method : "show_ip" |
|
231 | method : "show_ip" | |
217 | args : { |
|
232 | args : { | |
218 | "userid" : "<user_id or username>", |
|
233 | "userid" : "<user_id or username>", | |
219 | } |
|
234 | } | |
220 |
|
235 | |||
221 | OUTPUT:: |
|
236 | OUTPUT:: | |
222 |
|
237 | |||
223 | id : <id_given_in_input> |
|
238 | id : <id_given_in_input> | |
224 | result : { |
|
239 | result : { | |
225 | "ip_addr_server": <ip_from_clien>", |
|
240 | "ip_addr_server": <ip_from_clien>", | |
226 | "user_ips": [ |
|
241 | "user_ips": [ | |
227 | { |
|
242 | { | |
228 | "ip_addr": "<ip_with_mask>", |
|
243 | "ip_addr": "<ip_with_mask>", | |
229 | "ip_range": ["<start_ip>", "<end_ip>"], |
|
244 | "ip_range": ["<start_ip>", "<end_ip>"], | |
230 | }, |
|
245 | }, | |
231 | ... |
|
246 | ... | |
232 | ] |
|
247 | ] | |
233 | } |
|
248 | } | |
234 |
|
249 | |||
235 | error : null |
|
250 | error : null | |
236 |
|
251 | |||
237 |
|
252 | |||
238 | get_user |
|
253 | get_user | |
239 | -------- |
|
254 | -------- | |
240 |
|
255 | |||
241 | Get's an user by username or user_id, Returns empty result if user is not found. |
|
256 | Get's an user by username or user_id, Returns empty result if user is not found. | |
242 | If userid param is skipped it is set to id of user who is calling this method. |
|
257 | If userid param is skipped it is set to id of user who is calling this method. | |
243 | This command can be executed only using api_key belonging to user with admin |
|
258 | This command can be executed only using api_key belonging to user with admin | |
244 | rights, or regular users that cannot specify different userid than theirs |
|
259 | rights, or regular users that cannot specify different userid than theirs | |
245 |
|
260 | |||
246 |
|
261 | |||
247 | INPUT:: |
|
262 | INPUT:: | |
248 |
|
263 | |||
249 | id : <id_for_response> |
|
264 | id : <id_for_response> | |
250 | api_key : "<api_key>" |
|
265 | api_key : "<api_key>" | |
251 | method : "get_user" |
|
266 | method : "get_user" | |
252 | args : { |
|
267 | args : { | |
253 | "userid" : "<username or user_id Optional(=apiuser)>" |
|
268 | "userid" : "<username or user_id Optional(=apiuser)>" | |
254 | } |
|
269 | } | |
255 |
|
270 | |||
256 | OUTPUT:: |
|
271 | OUTPUT:: | |
257 |
|
272 | |||
258 | id : <id_given_in_input> |
|
273 | id : <id_given_in_input> | |
259 | result: None if user does not exist or |
|
274 | result: None if user does not exist or | |
260 | { |
|
275 | { | |
261 | "user_id" : "<user_id>", |
|
276 | "user_id" : "<user_id>", | |
262 | "api_key" : "<api_key>", |
|
277 | "api_key" : "<api_key>", | |
263 | "username" : "<username>", |
|
278 | "username" : "<username>", | |
264 | "firstname": "<firstname>", |
|
279 | "firstname": "<firstname>", | |
265 | "lastname" : "<lastname>", |
|
280 | "lastname" : "<lastname>", | |
266 | "email" : "<email>", |
|
281 | "email" : "<email>", | |
267 | "emails": "<list_of_all_additional_emails>", |
|
282 | "emails": "<list_of_all_additional_emails>", | |
268 | "ip_addresses": "<list_of_ip_addresses_for_user>", |
|
283 | "ip_addresses": "<list_of_ip_addresses_for_user>", | |
269 | "active" : "<bool>", |
|
284 | "active" : "<bool>", | |
270 | "admin" :Β "<bool>", |
|
285 | "admin" :Β "<bool>", | |
271 | "ldap_dn" : "<ldap_dn>", |
|
286 | "ldap_dn" : "<ldap_dn>", | |
272 | "last_login": "<last_login>", |
|
287 | "last_login": "<last_login>", | |
273 | "permissions": { |
|
288 | "permissions": { | |
274 | "global": ["hg.create.repository", |
|
289 | "global": ["hg.create.repository", | |
275 | "repository.read", |
|
290 | "repository.read", | |
276 | "hg.register.manual_activate"], |
|
291 | "hg.register.manual_activate"], | |
277 | "repositories": {"repo1": "repository.none"}, |
|
292 | "repositories": {"repo1": "repository.none"}, | |
278 | "repositories_groups": {"Group1": "group.read"} |
|
293 | "repositories_groups": {"Group1": "group.read"} | |
279 | }, |
|
294 | }, | |
280 | } |
|
295 | } | |
281 |
|
296 | |||
282 | error: null |
|
297 | error: null | |
283 |
|
298 | |||
284 |
|
299 | |||
285 | get_users |
|
300 | get_users | |
286 | --------- |
|
301 | --------- | |
287 |
|
302 | |||
288 | Lists all existing users. This command can be executed only using api_key |
|
303 | Lists all existing users. This command can be executed only using api_key | |
289 | belonging to user with admin rights. |
|
304 | belonging to user with admin rights. | |
290 |
|
305 | |||
291 |
|
306 | |||
292 | INPUT:: |
|
307 | INPUT:: | |
293 |
|
308 | |||
294 | id : <id_for_response> |
|
309 | id : <id_for_response> | |
295 | api_key : "<api_key>" |
|
310 | api_key : "<api_key>" | |
296 | method : "get_users" |
|
311 | method : "get_users" | |
297 | args : { } |
|
312 | args : { } | |
298 |
|
313 | |||
299 | OUTPUT:: |
|
314 | OUTPUT:: | |
300 |
|
315 | |||
301 | id : <id_given_in_input> |
|
316 | id : <id_given_in_input> | |
302 | result: [ |
|
317 | result: [ | |
303 | { |
|
318 | { | |
304 | "user_id" : "<user_id>", |
|
319 | "user_id" : "<user_id>", | |
305 | "username" : "<username>", |
|
320 | "username" : "<username>", | |
306 | "firstname": "<firstname>", |
|
321 | "firstname": "<firstname>", | |
307 | "lastname" : "<lastname>", |
|
322 | "lastname" : "<lastname>", | |
308 | "email" : "<email>", |
|
323 | "email" : "<email>", | |
309 | "emails": "<list_of_all_additional_emails>", |
|
324 | "emails": "<list_of_all_additional_emails>", | |
310 | "ip_addresses": "<list_of_ip_addresses_for_user>", |
|
325 | "ip_addresses": "<list_of_ip_addresses_for_user>", | |
311 | "active" : "<bool>", |
|
326 | "active" : "<bool>", | |
312 | "admin" :Β "<bool>", |
|
327 | "admin" :Β "<bool>", | |
313 | "ldap_dn" : "<ldap_dn>", |
|
328 | "ldap_dn" : "<ldap_dn>", | |
314 | "last_login": "<last_login>", |
|
329 | "last_login": "<last_login>", | |
315 | }, |
|
330 | }, | |
316 | β¦ |
|
331 | β¦ | |
317 | ] |
|
332 | ] | |
318 | error: null |
|
333 | error: null | |
319 |
|
334 | |||
320 |
|
335 | |||
321 | create_user |
|
336 | create_user | |
322 | ----------- |
|
337 | ----------- | |
323 |
|
338 | |||
324 | Creates new user. This command can |
|
339 | Creates new user. This command can | |
325 | be executed only using api_key belonging to user with admin rights. |
|
340 | be executed only using api_key belonging to user with admin rights. | |
326 |
|
341 | |||
327 |
|
342 | |||
328 | INPUT:: |
|
343 | INPUT:: | |
329 |
|
344 | |||
330 | id : <id_for_response> |
|
345 | id : <id_for_response> | |
331 | api_key : "<api_key>" |
|
346 | api_key : "<api_key>" | |
332 | method : "create_user" |
|
347 | method : "create_user" | |
333 | args : { |
|
348 | args : { | |
334 | "username" : "<username>", |
|
349 | "username" : "<username>", | |
335 | "email" : "<useremail>", |
|
350 | "email" : "<useremail>", | |
336 | "password" : "<password>", |
|
351 | "password" : "<password>", | |
337 | "firstname" : "<firstname> = Optional(None)", |
|
352 | "firstname" : "<firstname> = Optional(None)", | |
338 | "lastname" : "<lastname> = Optional(None)", |
|
353 | "lastname" : "<lastname> = Optional(None)", | |
339 | "active" : "<bool> = Optional(True)", |
|
354 | "active" : "<bool> = Optional(True)", | |
340 | "admin" : "<bool> = Optional(False)", |
|
355 | "admin" : "<bool> = Optional(False)", | |
341 | "ldap_dn" : "<ldap_dn> = Optional(None)" |
|
356 | "ldap_dn" : "<ldap_dn> = Optional(None)" | |
342 | } |
|
357 | } | |
343 |
|
358 | |||
344 | OUTPUT:: |
|
359 | OUTPUT:: | |
345 |
|
360 | |||
346 | id : <id_given_in_input> |
|
361 | id : <id_given_in_input> | |
347 | result: { |
|
362 | result: { | |
348 | "msg" : "created new user `<username>`", |
|
363 | "msg" : "created new user `<username>`", | |
349 | "user": { |
|
364 | "user": { | |
350 | "user_id" : "<user_id>", |
|
365 | "user_id" : "<user_id>", | |
351 | "username" : "<username>", |
|
366 | "username" : "<username>", | |
352 | "firstname": "<firstname>", |
|
367 | "firstname": "<firstname>", | |
353 | "lastname" : "<lastname>", |
|
368 | "lastname" : "<lastname>", | |
354 | "email" : "<email>", |
|
369 | "email" : "<email>", | |
355 | "emails": "<list_of_all_additional_emails>", |
|
370 | "emails": "<list_of_all_additional_emails>", | |
356 | "active" : "<bool>", |
|
371 | "active" : "<bool>", | |
357 | "admin" :Β "<bool>", |
|
372 | "admin" :Β "<bool>", | |
358 | "ldap_dn" : "<ldap_dn>", |
|
373 | "ldap_dn" : "<ldap_dn>", | |
359 | "last_login": "<last_login>", |
|
374 | "last_login": "<last_login>", | |
360 | }, |
|
375 | }, | |
361 | } |
|
376 | } | |
362 | error: null |
|
377 | error: null | |
363 |
|
378 | |||
364 |
|
379 | |||
365 | update_user |
|
380 | update_user | |
366 | ----------- |
|
381 | ----------- | |
367 |
|
382 | |||
368 | updates given user if such user exists. This command can |
|
383 | updates given user if such user exists. This command can | |
369 | be executed only using api_key belonging to user with admin rights. |
|
384 | be executed only using api_key belonging to user with admin rights. | |
370 |
|
385 | |||
371 |
|
386 | |||
372 | INPUT:: |
|
387 | INPUT:: | |
373 |
|
388 | |||
374 | id : <id_for_response> |
|
389 | id : <id_for_response> | |
375 | api_key : "<api_key>" |
|
390 | api_key : "<api_key>" | |
376 | method : "update_user" |
|
391 | method : "update_user" | |
377 | args : { |
|
392 | args : { | |
378 | "userid" : "<user_id or username>", |
|
393 | "userid" : "<user_id or username>", | |
379 | "username" : "<username> = Optional(None)", |
|
394 | "username" : "<username> = Optional(None)", | |
380 | "email" : "<useremail> = Optional(None)", |
|
395 | "email" : "<useremail> = Optional(None)", | |
381 | "password" : "<password> = Optional(None)", |
|
396 | "password" : "<password> = Optional(None)", | |
382 | "firstname" : "<firstname> = Optional(None)", |
|
397 | "firstname" : "<firstname> = Optional(None)", | |
383 | "lastname" : "<lastname> = Optional(None)", |
|
398 | "lastname" : "<lastname> = Optional(None)", | |
384 | "active" : "<bool> = Optional(None)", |
|
399 | "active" : "<bool> = Optional(None)", | |
385 | "admin" : "<bool> = Optional(None)", |
|
400 | "admin" : "<bool> = Optional(None)", | |
386 | "ldap_dn" : "<ldap_dn> = Optional(None)" |
|
401 | "ldap_dn" : "<ldap_dn> = Optional(None)" | |
387 | } |
|
402 | } | |
388 |
|
403 | |||
389 | OUTPUT:: |
|
404 | OUTPUT:: | |
390 |
|
405 | |||
391 | id : <id_given_in_input> |
|
406 | id : <id_given_in_input> | |
392 | result: { |
|
407 | result: { | |
393 | "msg" : "updated user ID:<userid> <username>", |
|
408 | "msg" : "updated user ID:<userid> <username>", | |
394 | "user": { |
|
409 | "user": { | |
395 | "user_id" : "<user_id>", |
|
410 | "user_id" : "<user_id>", | |
396 | "username" : "<username>", |
|
411 | "username" : "<username>", | |
397 | "firstname": "<firstname>", |
|
412 | "firstname": "<firstname>", | |
398 | "lastname" : "<lastname>", |
|
413 | "lastname" : "<lastname>", | |
399 | "email" : "<email>", |
|
414 | "email" : "<email>", | |
400 | "emails": "<list_of_all_additional_emails>", |
|
415 | "emails": "<list_of_all_additional_emails>", | |
401 | "active" : "<bool>", |
|
416 | "active" : "<bool>", | |
402 | "admin" :Β "<bool>", |
|
417 | "admin" :Β "<bool>", | |
403 | "ldap_dn" : "<ldap_dn>", |
|
418 | "ldap_dn" : "<ldap_dn>", | |
404 | "last_login": "<last_login>", |
|
419 | "last_login": "<last_login>", | |
405 | }, |
|
420 | }, | |
406 | } |
|
421 | } | |
407 | error: null |
|
422 | error: null | |
408 |
|
423 | |||
409 |
|
424 | |||
410 | delete_user |
|
425 | delete_user | |
411 | ----------- |
|
426 | ----------- | |
412 |
|
427 | |||
413 |
|
428 | |||
414 | deletes givenuser if such user exists. This command can |
|
429 | deletes givenuser if such user exists. This command can | |
415 | be executed only using api_key belonging to user with admin rights. |
|
430 | be executed only using api_key belonging to user with admin rights. | |
416 |
|
431 | |||
417 |
|
432 | |||
418 | INPUT:: |
|
433 | INPUT:: | |
419 |
|
434 | |||
420 | id : <id_for_response> |
|
435 | id : <id_for_response> | |
421 | api_key : "<api_key>" |
|
436 | api_key : "<api_key>" | |
422 | method : "delete_user" |
|
437 | method : "delete_user" | |
423 | args : { |
|
438 | args : { | |
424 | "userid" : "<user_id or username>", |
|
439 | "userid" : "<user_id or username>", | |
425 | } |
|
440 | } | |
426 |
|
441 | |||
427 | OUTPUT:: |
|
442 | OUTPUT:: | |
428 |
|
443 | |||
429 | id : <id_given_in_input> |
|
444 | id : <id_given_in_input> | |
430 | result: { |
|
445 | result: { | |
431 | "msg" : "deleted user ID:<userid> <username>", |
|
446 | "msg" : "deleted user ID:<userid> <username>", | |
432 | "user": null |
|
447 | "user": null | |
433 | } |
|
448 | } | |
434 | error: null |
|
449 | error: null | |
435 |
|
450 | |||
436 |
|
451 | |||
437 | get_users_group |
|
452 | get_users_group | |
438 | --------------- |
|
453 | --------------- | |
439 |
|
454 | |||
440 | Gets an existing user group. This command can be executed only using api_key |
|
455 | Gets an existing user group. This command can be executed only using api_key | |
441 | belonging to user with admin rights. |
|
456 | belonging to user with admin rights. | |
442 |
|
457 | |||
443 |
|
458 | |||
444 | INPUT:: |
|
459 | INPUT:: | |
445 |
|
460 | |||
446 | id : <id_for_response> |
|
461 | id : <id_for_response> | |
447 | api_key : "<api_key>" |
|
462 | api_key : "<api_key>" | |
448 | method : "get_users_group" |
|
463 | method : "get_users_group" | |
449 | args : { |
|
464 | args : { | |
450 | "usersgroupid" : "<user group id or name>" |
|
465 | "usersgroupid" : "<user group id or name>" | |
451 | } |
|
466 | } | |
452 |
|
467 | |||
453 | OUTPUT:: |
|
468 | OUTPUT:: | |
454 |
|
469 | |||
455 | id : <id_given_in_input> |
|
470 | id : <id_given_in_input> | |
456 | result : None if group not exist |
|
471 | result : None if group not exist | |
457 | { |
|
472 | { | |
458 | "users_group_id" : "<id>", |
|
473 | "users_group_id" : "<id>", | |
459 | "group_name" : "<groupname>", |
|
474 | "group_name" : "<groupname>", | |
460 | "active": "<bool>", |
|
475 | "active": "<bool>", | |
461 | "members" : [ |
|
476 | "members" : [ | |
462 | { |
|
477 | { | |
463 | "user_id" : "<user_id>", |
|
478 | "user_id" : "<user_id>", | |
464 | "username" : "<username>", |
|
479 | "username" : "<username>", | |
465 | "firstname": "<firstname>", |
|
480 | "firstname": "<firstname>", | |
466 | "lastname" : "<lastname>", |
|
481 | "lastname" : "<lastname>", | |
467 | "email" : "<email>", |
|
482 | "email" : "<email>", | |
468 | "emails": "<list_of_all_additional_emails>", |
|
483 | "emails": "<list_of_all_additional_emails>", | |
469 | "active" : "<bool>", |
|
484 | "active" : "<bool>", | |
470 | "admin" :Β "<bool>", |
|
485 | "admin" :Β "<bool>", | |
471 | "ldap_dn" : "<ldap_dn>", |
|
486 | "ldap_dn" : "<ldap_dn>", | |
472 | "last_login": "<last_login>", |
|
487 | "last_login": "<last_login>", | |
473 | }, |
|
488 | }, | |
474 | β¦ |
|
489 | β¦ | |
475 | ] |
|
490 | ] | |
476 | } |
|
491 | } | |
477 | error : null |
|
492 | error : null | |
478 |
|
493 | |||
479 |
|
494 | |||
480 | get_users_groups |
|
495 | get_users_groups | |
481 | ---------------- |
|
496 | ---------------- | |
482 |
|
497 | |||
483 | Lists all existing user groups. This command can be executed only using |
|
498 | Lists all existing user groups. This command can be executed only using | |
484 | api_key belonging to user with admin rights. |
|
499 | api_key belonging to user with admin rights. | |
485 |
|
500 | |||
486 |
|
501 | |||
487 | INPUT:: |
|
502 | INPUT:: | |
488 |
|
503 | |||
489 | id : <id_for_response> |
|
504 | id : <id_for_response> | |
490 | api_key : "<api_key>" |
|
505 | api_key : "<api_key>" | |
491 | method : "get_users_groups" |
|
506 | method : "get_users_groups" | |
492 | args : { } |
|
507 | args : { } | |
493 |
|
508 | |||
494 | OUTPUT:: |
|
509 | OUTPUT:: | |
495 |
|
510 | |||
496 | id : <id_given_in_input> |
|
511 | id : <id_given_in_input> | |
497 | result : [ |
|
512 | result : [ | |
498 | { |
|
513 | { | |
499 | "users_group_id" : "<id>", |
|
514 | "users_group_id" : "<id>", | |
500 | "group_name" : "<groupname>", |
|
515 | "group_name" : "<groupname>", | |
501 | "active": "<bool>", |
|
516 | "active": "<bool>", | |
502 | }, |
|
517 | }, | |
503 | β¦ |
|
518 | β¦ | |
504 | ] |
|
519 | ] | |
505 | error : null |
|
520 | error : null | |
506 |
|
521 | |||
507 |
|
522 | |||
508 | create_users_group |
|
523 | create_users_group | |
509 | ------------------ |
|
524 | ------------------ | |
510 |
|
525 | |||
511 | Creates new user group. This command can be executed only using api_key |
|
526 | Creates new user group. This command can be executed only using api_key | |
512 | belonging to user with admin rights |
|
527 | belonging to user with admin rights | |
513 |
|
528 | |||
514 |
|
529 | |||
515 | INPUT:: |
|
530 | INPUT:: | |
516 |
|
531 | |||
517 | id : <id_for_response> |
|
532 | id : <id_for_response> | |
518 | api_key : "<api_key>" |
|
533 | api_key : "<api_key>" | |
519 | method : "create_users_group" |
|
534 | method : "create_users_group" | |
520 | args: { |
|
535 | args: { | |
521 | "group_name": "<groupname>", |
|
536 | "group_name": "<groupname>", | |
522 | "owner" : "<onwer_name_or_id = Optional(=apiuser)>", |
|
537 | "owner" : "<onwer_name_or_id = Optional(=apiuser)>", | |
523 | "active": "<bool> = Optional(True)" |
|
538 | "active": "<bool> = Optional(True)" | |
524 | } |
|
539 | } | |
525 |
|
540 | |||
526 | OUTPUT:: |
|
541 | OUTPUT:: | |
527 |
|
542 | |||
528 | id : <id_given_in_input> |
|
543 | id : <id_given_in_input> | |
529 | result: { |
|
544 | result: { | |
530 | "msg": "created new user group `<groupname>`", |
|
545 | "msg": "created new user group `<groupname>`", | |
531 | "users_group": { |
|
546 | "users_group": { | |
532 | "users_group_id" : "<id>", |
|
547 | "users_group_id" : "<id>", | |
533 | "group_name" : "<groupname>", |
|
548 | "group_name" : "<groupname>", | |
534 | "active": "<bool>", |
|
549 | "active": "<bool>", | |
535 | }, |
|
550 | }, | |
536 | } |
|
551 | } | |
537 | error: null |
|
552 | error: null | |
538 |
|
553 | |||
539 |
|
554 | |||
540 | add_user_to_users_group |
|
555 | add_user_to_users_group | |
541 | ----------------------- |
|
556 | ----------------------- | |
542 |
|
557 | |||
543 | Adds a user to a user group. If user exists in that group success will be |
|
558 | Adds a user to a user group. If user exists in that group success will be | |
544 | `false`. This command can be executed only using api_key |
|
559 | `false`. This command can be executed only using api_key | |
545 | belonging to user with admin rights |
|
560 | belonging to user with admin rights | |
546 |
|
561 | |||
547 |
|
562 | |||
548 | INPUT:: |
|
563 | INPUT:: | |
549 |
|
564 | |||
550 | id : <id_for_response> |
|
565 | id : <id_for_response> | |
551 | api_key : "<api_key>" |
|
566 | api_key : "<api_key>" | |
552 | method : "add_user_users_group" |
|
567 | method : "add_user_users_group" | |
553 | args: { |
|
568 | args: { | |
554 | "usersgroupid" : "<user group id or name>", |
|
569 | "usersgroupid" : "<user group id or name>", | |
555 | "userid" : "<user_id or username>", |
|
570 | "userid" : "<user_id or username>", | |
556 | } |
|
571 | } | |
557 |
|
572 | |||
558 | OUTPUT:: |
|
573 | OUTPUT:: | |
559 |
|
574 | |||
560 | id : <id_given_in_input> |
|
575 | id : <id_given_in_input> | |
561 | result: { |
|
576 | result: { | |
562 | "success": True|False # depends on if member is in group |
|
577 | "success": True|False # depends on if member is in group | |
563 | "msg": "added member `<username>` to user group `<groupname>` | |
|
578 | "msg": "added member `<username>` to user group `<groupname>` | | |
564 | User is already in that group" |
|
579 | User is already in that group" | |
565 | } |
|
580 | } | |
566 | error: null |
|
581 | error: null | |
567 |
|
582 | |||
568 |
|
583 | |||
569 | remove_user_from_users_group |
|
584 | remove_user_from_users_group | |
570 | ---------------------------- |
|
585 | ---------------------------- | |
571 |
|
586 | |||
572 | Removes a user from a user group. If user is not in given group success will |
|
587 | Removes a user from a user group. If user is not in given group success will | |
573 | be `false`. This command can be executed only |
|
588 | be `false`. This command can be executed only | |
574 | using api_key belonging to user with admin rights |
|
589 | using api_key belonging to user with admin rights | |
575 |
|
590 | |||
576 |
|
591 | |||
577 | INPUT:: |
|
592 | INPUT:: | |
578 |
|
593 | |||
579 | id : <id_for_response> |
|
594 | id : <id_for_response> | |
580 | api_key : "<api_key>" |
|
595 | api_key : "<api_key>" | |
581 | method : "remove_user_from_users_group" |
|
596 | method : "remove_user_from_users_group" | |
582 | args: { |
|
597 | args: { | |
583 | "usersgroupid" : "<user group id or name>", |
|
598 | "usersgroupid" : "<user group id or name>", | |
584 | "userid" : "<user_id or username>", |
|
599 | "userid" : "<user_id or username>", | |
585 | } |
|
600 | } | |
586 |
|
601 | |||
587 | OUTPUT:: |
|
602 | OUTPUT:: | |
588 |
|
603 | |||
589 | id : <id_given_in_input> |
|
604 | id : <id_given_in_input> | |
590 | result: { |
|
605 | result: { | |
591 | "success": True|False, # depends on if member is in group |
|
606 | "success": True|False, # depends on if member is in group | |
592 | "msg": "removed member <username> from user group <groupname> | |
|
607 | "msg": "removed member <username> from user group <groupname> | | |
593 | User wasn't in group" |
|
608 | User wasn't in group" | |
594 | } |
|
609 | } | |
595 | error: null |
|
610 | error: null | |
596 |
|
611 | |||
597 |
|
612 | |||
598 | get_repo |
|
613 | get_repo | |
599 | -------- |
|
614 | -------- | |
600 |
|
615 | |||
601 | Gets an existing repository by it's name or repository_id. Members will return |
|
616 | Gets an existing repository by it's name or repository_id. Members will return | |
602 | either users_group or user associated to that repository. This command can be |
|
617 | either users_group or user associated to that repository. This command can be | |
603 | executed only using api_key belonging to user with admin |
|
618 | executed only using api_key belonging to user with admin | |
604 | rights or regular user that have at least read access to repository. |
|
619 | rights or regular user that have at least read access to repository. | |
605 |
|
620 | |||
606 |
|
621 | |||
607 | INPUT:: |
|
622 | INPUT:: | |
608 |
|
623 | |||
609 | id : <id_for_response> |
|
624 | id : <id_for_response> | |
610 | api_key : "<api_key>" |
|
625 | api_key : "<api_key>" | |
611 | method : "get_repo" |
|
626 | method : "get_repo" | |
612 | args: { |
|
627 | args: { | |
613 | "repoid" : "<reponame or repo_id>" |
|
628 | "repoid" : "<reponame or repo_id>" | |
614 | } |
|
629 | } | |
615 |
|
630 | |||
616 | OUTPUT:: |
|
631 | OUTPUT:: | |
617 |
|
632 | |||
618 | id : <id_given_in_input> |
|
633 | id : <id_given_in_input> | |
619 | result: None if repository does not exist or |
|
634 | result: None if repository does not exist or | |
620 | { |
|
635 | { | |
621 | "repo_id" : "<repo_id>", |
|
636 | "repo_id" : "<repo_id>", | |
622 | "repo_name" : "<reponame>" |
|
637 | "repo_name" : "<reponame>" | |
623 | "repo_type" : "<repo_type>", |
|
638 | "repo_type" : "<repo_type>", | |
624 | "clone_uri" : "<clone_uri>", |
|
639 | "clone_uri" : "<clone_uri>", | |
625 | "enable_downloads": "<bool>", |
|
640 | "enable_downloads": "<bool>", | |
626 | "enable_locking": "<bool>", |
|
641 | "enable_locking": "<bool>", | |
627 | "enable_statistics": "<bool>", |
|
642 | "enable_statistics": "<bool>", | |
628 | "private": "<bool>", |
|
643 | "private": "<bool>", | |
629 | "created_on" : "<date_time_created>", |
|
644 | "created_on" : "<date_time_created>", | |
630 | "description" : "<description>", |
|
645 | "description" : "<description>", | |
631 | "landing_rev": "<landing_rev>", |
|
646 | "landing_rev": "<landing_rev>", | |
632 | "last_changeset": { |
|
647 | "last_changeset": { | |
633 | "author": "<full_author>", |
|
648 | "author": "<full_author>", | |
634 | "date": "<date_time_of_commit>", |
|
649 | "date": "<date_time_of_commit>", | |
635 | "message": "<commit_message>", |
|
650 | "message": "<commit_message>", | |
636 | "raw_id": "<raw_id>", |
|
651 | "raw_id": "<raw_id>", | |
637 | "revision": "<numeric_revision>", |
|
652 | "revision": "<numeric_revision>", | |
638 | "short_id": "<short_id>" |
|
653 | "short_id": "<short_id>" | |
639 | } |
|
654 | } | |
640 | "owner": "<repo_owner>", |
|
655 | "owner": "<repo_owner>", | |
641 | "fork_of": "<name_of_fork_parent>", |
|
656 | "fork_of": "<name_of_fork_parent>", | |
642 | "members" : [ |
|
657 | "members" : [ | |
643 | { |
|
658 | { | |
644 | "type": "user", |
|
659 | "type": "user", | |
645 | "user_id" : "<user_id>", |
|
660 | "user_id" : "<user_id>", | |
646 | "username" : "<username>", |
|
661 | "username" : "<username>", | |
647 | "firstname": "<firstname>", |
|
662 | "firstname": "<firstname>", | |
648 | "lastname" : "<lastname>", |
|
663 | "lastname" : "<lastname>", | |
649 | "email" : "<email>", |
|
664 | "email" : "<email>", | |
650 | "emails": "<list_of_all_additional_emails>", |
|
665 | "emails": "<list_of_all_additional_emails>", | |
651 | "active" : "<bool>", |
|
666 | "active" : "<bool>", | |
652 | "admin" :Β "<bool>", |
|
667 | "admin" :Β "<bool>", | |
653 | "ldap_dn" : "<ldap_dn>", |
|
668 | "ldap_dn" : "<ldap_dn>", | |
654 | "last_login": "<last_login>", |
|
669 | "last_login": "<last_login>", | |
655 | "permission" : "repository.(read|write|admin)" |
|
670 | "permission" : "repository.(read|write|admin)" | |
656 | }, |
|
671 | }, | |
657 | β¦ |
|
672 | β¦ | |
658 | { |
|
673 | { | |
659 | "type": "users_group", |
|
674 | "type": "users_group", | |
660 | "id" : "<usersgroupid>", |
|
675 | "id" : "<usersgroupid>", | |
661 | "name" : "<usersgroupname>", |
|
676 | "name" : "<usersgroupname>", | |
662 | "active": "<bool>", |
|
677 | "active": "<bool>", | |
663 | "permission" : "repository.(read|write|admin)" |
|
678 | "permission" : "repository.(read|write|admin)" | |
664 | }, |
|
679 | }, | |
665 | β¦ |
|
680 | β¦ | |
666 | ] |
|
681 | ] | |
667 | "followers": [ |
|
682 | "followers": [ | |
668 | { |
|
683 | { | |
669 | "user_id" : "<user_id>", |
|
684 | "user_id" : "<user_id>", | |
670 | "username" : "<username>", |
|
685 | "username" : "<username>", | |
671 | "firstname": "<firstname>", |
|
686 | "firstname": "<firstname>", | |
672 | "lastname" : "<lastname>", |
|
687 | "lastname" : "<lastname>", | |
673 | "email" : "<email>", |
|
688 | "email" : "<email>", | |
674 | "emails": "<list_of_all_additional_emails>", |
|
689 | "emails": "<list_of_all_additional_emails>", | |
675 | "ip_addresses": "<list_of_ip_addresses_for_user>", |
|
690 | "ip_addresses": "<list_of_ip_addresses_for_user>", | |
676 | "active" : "<bool>", |
|
691 | "active" : "<bool>", | |
677 | "admin" :Β "<bool>", |
|
692 | "admin" :Β "<bool>", | |
678 | "ldap_dn" : "<ldap_dn>", |
|
693 | "ldap_dn" : "<ldap_dn>", | |
679 | "last_login": "<last_login>", |
|
694 | "last_login": "<last_login>", | |
680 | }, |
|
695 | }, | |
681 | β¦ |
|
696 | β¦ | |
682 | ] |
|
697 | ] | |
683 | } |
|
698 | } | |
684 | error: null |
|
699 | error: null | |
685 |
|
700 | |||
686 |
|
701 | |||
687 | get_repos |
|
702 | get_repos | |
688 | --------- |
|
703 | --------- | |
689 |
|
704 | |||
690 | Lists all existing repositories. This command can be executed only using |
|
705 | Lists all existing repositories. This command can be executed only using | |
691 | api_key belonging to user with admin rights or regular user that have |
|
706 | api_key belonging to user with admin rights or regular user that have | |
692 | admin, write or read access to repository. |
|
707 | admin, write or read access to repository. | |
693 |
|
708 | |||
694 |
|
709 | |||
695 | INPUT:: |
|
710 | INPUT:: | |
696 |
|
711 | |||
697 | id : <id_for_response> |
|
712 | id : <id_for_response> | |
698 | api_key : "<api_key>" |
|
713 | api_key : "<api_key>" | |
699 | method : "get_repos" |
|
714 | method : "get_repos" | |
700 | args: { } |
|
715 | args: { } | |
701 |
|
716 | |||
702 | OUTPUT:: |
|
717 | OUTPUT:: | |
703 |
|
718 | |||
704 | id : <id_given_in_input> |
|
719 | id : <id_given_in_input> | |
705 | result: [ |
|
720 | result: [ | |
706 | { |
|
721 | { | |
707 | "repo_id" : "<repo_id>", |
|
722 | "repo_id" : "<repo_id>", | |
708 | "repo_name" : "<reponame>" |
|
723 | "repo_name" : "<reponame>" | |
709 | "repo_type" : "<repo_type>", |
|
724 | "repo_type" : "<repo_type>", | |
710 | "clone_uri" : "<clone_uri>", |
|
725 | "clone_uri" : "<clone_uri>", | |
711 | "private": : "<bool>", |
|
726 | "private": : "<bool>", | |
712 | "created_on" : "<datetimecreated>", |
|
727 | "created_on" : "<datetimecreated>", | |
713 | "description" : "<description>", |
|
728 | "description" : "<description>", | |
714 | "landing_rev": "<landing_rev>", |
|
729 | "landing_rev": "<landing_rev>", | |
715 | "owner": "<repo_owner>", |
|
730 | "owner": "<repo_owner>", | |
716 | "fork_of": "<name_of_fork_parent>", |
|
731 | "fork_of": "<name_of_fork_parent>", | |
717 | "enable_downloads": "<bool>", |
|
732 | "enable_downloads": "<bool>", | |
718 | "enable_locking": "<bool>", |
|
733 | "enable_locking": "<bool>", | |
719 | "enable_statistics": "<bool>", |
|
734 | "enable_statistics": "<bool>", | |
720 | }, |
|
735 | }, | |
721 | β¦ |
|
736 | β¦ | |
722 | ] |
|
737 | ] | |
723 | error: null |
|
738 | error: null | |
724 |
|
739 | |||
725 |
|
740 | |||
726 | get_repo_nodes |
|
741 | get_repo_nodes | |
727 | -------------- |
|
742 | -------------- | |
728 |
|
743 | |||
729 | returns a list of nodes and it's children in a flat list for a given path |
|
744 | returns a list of nodes and it's children in a flat list for a given path | |
730 | at given revision. It's possible to specify ret_type to show only `files` or |
|
745 | at given revision. It's possible to specify ret_type to show only `files` or | |
731 | `dirs`. This command can be executed only using api_key belonging to user |
|
746 | `dirs`. This command can be executed only using api_key belonging to user | |
732 | with admin rights |
|
747 | with admin rights | |
733 |
|
748 | |||
734 |
|
749 | |||
735 | INPUT:: |
|
750 | INPUT:: | |
736 |
|
751 | |||
737 | id : <id_for_response> |
|
752 | id : <id_for_response> | |
738 | api_key : "<api_key>" |
|
753 | api_key : "<api_key>" | |
739 | method : "get_repo_nodes" |
|
754 | method : "get_repo_nodes" | |
740 | args: { |
|
755 | args: { | |
741 | "repoid" : "<reponame or repo_id>" |
|
756 | "repoid" : "<reponame or repo_id>" | |
742 | "revision" : "<revision>", |
|
757 | "revision" : "<revision>", | |
743 | "root_path" : "<root_path>", |
|
758 | "root_path" : "<root_path>", | |
744 | "ret_type" : "<ret_type> = Optional('all')" |
|
759 | "ret_type" : "<ret_type> = Optional('all')" | |
745 | } |
|
760 | } | |
746 |
|
761 | |||
747 | OUTPUT:: |
|
762 | OUTPUT:: | |
748 |
|
763 | |||
749 | id : <id_given_in_input> |
|
764 | id : <id_given_in_input> | |
750 | result: [ |
|
765 | result: [ | |
751 | { |
|
766 | { | |
752 | "name" : "<name>" |
|
767 | "name" : "<name>" | |
753 | "type" : "<type>", |
|
768 | "type" : "<type>", | |
754 | }, |
|
769 | }, | |
755 | β¦ |
|
770 | β¦ | |
756 | ] |
|
771 | ] | |
757 | error: null |
|
772 | error: null | |
758 |
|
773 | |||
759 |
|
774 | |||
760 | create_repo |
|
775 | create_repo | |
761 | ----------- |
|
776 | ----------- | |
762 |
|
777 | |||
763 | Creates a repository. If repository name contains "/", all needed repository |
|
778 | Creates a repository. If repository name contains "/", all needed repository | |
764 | groups will be created. For example "foo/bar/baz" will create groups |
|
779 | groups will be created. For example "foo/bar/baz" will create groups | |
765 | "foo", "bar" (with "foo" as parent), and create "baz" repository with |
|
780 | "foo", "bar" (with "foo" as parent), and create "baz" repository with | |
766 | "bar" as group. This command can be executed only using api_key belonging to user with admin |
|
781 | "bar" as group. This command can be executed only using api_key belonging to user with admin | |
767 | rights or regular user that have create repository permission. Regular users |
|
782 | rights or regular user that have create repository permission. Regular users | |
768 | cannot specify owner parameter |
|
783 | cannot specify owner parameter | |
769 |
|
784 | |||
770 |
|
785 | |||
771 | INPUT:: |
|
786 | INPUT:: | |
772 |
|
787 | |||
773 | id : <id_for_response> |
|
788 | id : <id_for_response> | |
774 | api_key : "<api_key>" |
|
789 | api_key : "<api_key>" | |
775 | method : "create_repo" |
|
790 | method : "create_repo" | |
776 | args: { |
|
791 | args: { | |
777 | "repo_name" : "<reponame>", |
|
792 | "repo_name" : "<reponame>", | |
778 | "owner" : "<onwer_name_or_id = Optional(=apiuser)>", |
|
793 | "owner" : "<onwer_name_or_id = Optional(=apiuser)>", | |
779 | "repo_type" : "<repo_type> = Optional('hg')", |
|
794 | "repo_type" : "<repo_type> = Optional('hg')", | |
780 | "description" : "<description> = Optional('')", |
|
795 | "description" : "<description> = Optional('')", | |
781 | "private" : "<bool> = Optional(False)", |
|
796 | "private" : "<bool> = Optional(False)", | |
782 | "clone_uri" : "<clone_uri> = Optional(None)", |
|
797 | "clone_uri" : "<clone_uri> = Optional(None)", | |
783 | "landing_rev" : "<landing_rev> = Optional('tip')", |
|
798 | "landing_rev" : "<landing_rev> = Optional('tip')", | |
784 | "enable_downloads": "<bool> = Optional(False)", |
|
799 | "enable_downloads": "<bool> = Optional(False)", | |
785 | "enable_locking": "<bool> = Optional(False)", |
|
800 | "enable_locking": "<bool> = Optional(False)", | |
786 | "enable_statistics": "<bool> = Optional(False)", |
|
801 | "enable_statistics": "<bool> = Optional(False)", | |
787 | } |
|
802 | } | |
788 |
|
803 | |||
789 | OUTPUT:: |
|
804 | OUTPUT:: | |
790 |
|
805 | |||
791 | id : <id_given_in_input> |
|
806 | id : <id_given_in_input> | |
792 | result: { |
|
807 | result: { | |
793 | "msg": "Created new repository `<reponame>`", |
|
808 | "msg": "Created new repository `<reponame>`", | |
794 | "repo": { |
|
809 | "repo": { | |
795 | "repo_id" : "<repo_id>", |
|
810 | "repo_id" : "<repo_id>", | |
796 | "repo_name" : "<reponame>" |
|
811 | "repo_name" : "<reponame>" | |
797 | "repo_type" : "<repo_type>", |
|
812 | "repo_type" : "<repo_type>", | |
798 | "clone_uri" : "<clone_uri>", |
|
813 | "clone_uri" : "<clone_uri>", | |
799 | "private": : "<bool>", |
|
814 | "private": : "<bool>", | |
800 | "created_on" : "<datetimecreated>", |
|
815 | "created_on" : "<datetimecreated>", | |
801 | "description" : "<description>", |
|
816 | "description" : "<description>", | |
802 | "landing_rev": "<landing_rev>", |
|
817 | "landing_rev": "<landing_rev>", | |
803 | "owner": "<username or user_id>", |
|
818 | "owner": "<username or user_id>", | |
804 | "fork_of": "<name_of_fork_parent>", |
|
819 | "fork_of": "<name_of_fork_parent>", | |
805 | "enable_downloads": "<bool>", |
|
820 | "enable_downloads": "<bool>", | |
806 | "enable_locking": "<bool>", |
|
821 | "enable_locking": "<bool>", | |
807 | "enable_statistics": "<bool>", |
|
822 | "enable_statistics": "<bool>", | |
808 | }, |
|
823 | }, | |
809 | } |
|
824 | } | |
810 | error: null |
|
825 | error: null | |
811 |
|
826 | |||
812 |
|
827 | |||
813 | fork_repo |
|
828 | fork_repo | |
814 | --------- |
|
829 | --------- | |
815 |
|
830 | |||
816 | Creates a fork of given repo. In case of using celery this will |
|
831 | Creates a fork of given repo. In case of using celery this will | |
817 | immidiatelly return success message, while fork is going to be created |
|
832 | immidiatelly return success message, while fork is going to be created | |
818 | asynchronous. This command can be executed only using api_key belonging to |
|
833 | asynchronous. This command can be executed only using api_key belonging to | |
819 | user with admin rights or regular user that have fork permission, and at least |
|
834 | user with admin rights or regular user that have fork permission, and at least | |
820 | read access to forking repository. Regular users cannot specify owner parameter. |
|
835 | read access to forking repository. Regular users cannot specify owner parameter. | |
821 |
|
836 | |||
822 |
|
837 | |||
823 | INPUT:: |
|
838 | INPUT:: | |
824 |
|
839 | |||
825 | id : <id_for_response> |
|
840 | id : <id_for_response> | |
826 | api_key : "<api_key>" |
|
841 | api_key : "<api_key>" | |
827 | method : "fork_repo" |
|
842 | method : "fork_repo" | |
828 | args: { |
|
843 | args: { | |
829 | "repoid" : "<reponame or repo_id>", |
|
844 | "repoid" : "<reponame or repo_id>", | |
830 | "fork_name": "<forkname>", |
|
845 | "fork_name": "<forkname>", | |
831 | "owner": "<username or user_id = Optional(=apiuser)>", |
|
846 | "owner": "<username or user_id = Optional(=apiuser)>", | |
832 | "description": "<description>", |
|
847 | "description": "<description>", | |
833 | "copy_permissions": "<bool>", |
|
848 | "copy_permissions": "<bool>", | |
834 | "private": "<bool>", |
|
849 | "private": "<bool>", | |
835 | "landing_rev": "<landing_rev>" |
|
850 | "landing_rev": "<landing_rev>" | |
836 |
|
851 | |||
837 | } |
|
852 | } | |
838 |
|
853 | |||
839 | OUTPUT:: |
|
854 | OUTPUT:: | |
840 |
|
855 | |||
841 | id : <id_given_in_input> |
|
856 | id : <id_given_in_input> | |
842 | result: { |
|
857 | result: { | |
843 | "msg": "Created fork of `<reponame>` as `<forkname>`", |
|
858 | "msg": "Created fork of `<reponame>` as `<forkname>`", | |
844 | "success": true |
|
859 | "success": true | |
845 | } |
|
860 | } | |
846 | error: null |
|
861 | error: null | |
847 |
|
862 | |||
848 |
|
863 | |||
849 | delete_repo |
|
864 | delete_repo | |
850 | ----------- |
|
865 | ----------- | |
851 |
|
866 | |||
852 | Deletes a repository. This command can be executed only using api_key belonging |
|
867 | Deletes a repository. This command can be executed only using api_key belonging | |
853 | to user with admin rights or regular user that have admin access to repository. |
|
868 | to user with admin rights or regular user that have admin access to repository. | |
854 | When `forks` param is set it's possible to detach or delete forks of deleting |
|
869 | When `forks` param is set it's possible to detach or delete forks of deleting | |
855 | repository |
|
870 | repository | |
856 |
|
871 | |||
857 |
|
872 | |||
858 | INPUT:: |
|
873 | INPUT:: | |
859 |
|
874 | |||
860 | id : <id_for_response> |
|
875 | id : <id_for_response> | |
861 | api_key : "<api_key>" |
|
876 | api_key : "<api_key>" | |
862 | method : "delete_repo" |
|
877 | method : "delete_repo" | |
863 | args: { |
|
878 | args: { | |
864 | "repoid" : "<reponame or repo_id>", |
|
879 | "repoid" : "<reponame or repo_id>", | |
865 | "forks" : "`delete` or `detach` = Optional(None)" |
|
880 | "forks" : "`delete` or `detach` = Optional(None)" | |
866 | } |
|
881 | } | |
867 |
|
882 | |||
868 | OUTPUT:: |
|
883 | OUTPUT:: | |
869 |
|
884 | |||
870 | id : <id_given_in_input> |
|
885 | id : <id_given_in_input> | |
871 | result: { |
|
886 | result: { | |
872 | "msg": "Deleted repository `<reponame>`", |
|
887 | "msg": "Deleted repository `<reponame>`", | |
873 | "success": true |
|
888 | "success": true | |
874 | } |
|
889 | } | |
875 | error: null |
|
890 | error: null | |
876 |
|
891 | |||
877 |
|
892 | |||
878 | grant_user_permission |
|
893 | grant_user_permission | |
879 | --------------------- |
|
894 | --------------------- | |
880 |
|
895 | |||
881 | Grant permission for user on given repository, or update existing one |
|
896 | Grant permission for user on given repository, or update existing one | |
882 | if found. This command can be executed only using api_key belonging to user |
|
897 | if found. This command can be executed only using api_key belonging to user | |
883 | with admin rights. |
|
898 | with admin rights. | |
884 |
|
899 | |||
885 |
|
900 | |||
886 | INPUT:: |
|
901 | INPUT:: | |
887 |
|
902 | |||
888 | id : <id_for_response> |
|
903 | id : <id_for_response> | |
889 | api_key : "<api_key>" |
|
904 | api_key : "<api_key>" | |
890 | method : "grant_user_permission" |
|
905 | method : "grant_user_permission" | |
891 | args: { |
|
906 | args: { | |
892 | "repoid" : "<reponame or repo_id>" |
|
907 | "repoid" : "<reponame or repo_id>" | |
893 | "userid" : "<username or user_id>" |
|
908 | "userid" : "<username or user_id>" | |
894 | "perm" : "(repository.(none|read|write|admin))", |
|
909 | "perm" : "(repository.(none|read|write|admin))", | |
895 | } |
|
910 | } | |
896 |
|
911 | |||
897 | OUTPUT:: |
|
912 | OUTPUT:: | |
898 |
|
913 | |||
899 | id : <id_given_in_input> |
|
914 | id : <id_given_in_input> | |
900 | result: { |
|
915 | result: { | |
901 | "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`", |
|
916 | "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`", | |
902 | "success": true |
|
917 | "success": true | |
903 | } |
|
918 | } | |
904 | error: null |
|
919 | error: null | |
905 |
|
920 | |||
906 |
|
921 | |||
907 | revoke_user_permission |
|
922 | revoke_user_permission | |
908 | ---------------------- |
|
923 | ---------------------- | |
909 |
|
924 | |||
910 | Revoke permission for user on given repository. This command can be executed |
|
925 | Revoke permission for user on given repository. This command can be executed | |
911 | only using api_key belonging to user with admin rights. |
|
926 | only using api_key belonging to user with admin rights. | |
912 |
|
927 | |||
913 |
|
928 | |||
914 | INPUT:: |
|
929 | INPUT:: | |
915 |
|
930 | |||
916 | id : <id_for_response> |
|
931 | id : <id_for_response> | |
917 | api_key : "<api_key>" |
|
932 | api_key : "<api_key>" | |
918 | method : "revoke_user_permission" |
|
933 | method : "revoke_user_permission" | |
919 | args: { |
|
934 | args: { | |
920 | "repoid" : "<reponame or repo_id>" |
|
935 | "repoid" : "<reponame or repo_id>" | |
921 | "userid" : "<username or user_id>" |
|
936 | "userid" : "<username or user_id>" | |
922 | } |
|
937 | } | |
923 |
|
938 | |||
924 | OUTPUT:: |
|
939 | OUTPUT:: | |
925 |
|
940 | |||
926 | id : <id_given_in_input> |
|
941 | id : <id_given_in_input> | |
927 | result: { |
|
942 | result: { | |
928 | "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`", |
|
943 | "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`", | |
929 | "success": true |
|
944 | "success": true | |
930 | } |
|
945 | } | |
931 | error: null |
|
946 | error: null | |
932 |
|
947 | |||
933 |
|
948 | |||
934 | grant_users_group_permission |
|
949 | grant_users_group_permission | |
935 | ---------------------------- |
|
950 | ---------------------------- | |
936 |
|
951 | |||
937 | Grant permission for user group on given repository, or update |
|
952 | Grant permission for user group on given repository, or update | |
938 | existing one if found. This command can be executed only using |
|
953 | existing one if found. This command can be executed only using | |
939 | api_key belonging to user with admin rights. |
|
954 | api_key belonging to user with admin rights. | |
940 |
|
955 | |||
941 |
|
956 | |||
942 | INPUT:: |
|
957 | INPUT:: | |
943 |
|
958 | |||
944 | id : <id_for_response> |
|
959 | id : <id_for_response> | |
945 | api_key : "<api_key>" |
|
960 | api_key : "<api_key>" | |
946 | method : "grant_users_group_permission" |
|
961 | method : "grant_users_group_permission" | |
947 | args: { |
|
962 | args: { | |
948 | "repoid" : "<reponame or repo_id>" |
|
963 | "repoid" : "<reponame or repo_id>" | |
949 | "usersgroupid" : "<user group id or name>" |
|
964 | "usersgroupid" : "<user group id or name>" | |
950 | "perm" : "(repository.(none|read|write|admin))", |
|
965 | "perm" : "(repository.(none|read|write|admin))", | |
951 | } |
|
966 | } | |
952 |
|
967 | |||
953 | OUTPUT:: |
|
968 | OUTPUT:: | |
954 |
|
969 | |||
955 | id : <id_given_in_input> |
|
970 | id : <id_given_in_input> | |
956 | result: { |
|
971 | result: { | |
957 | "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`", |
|
972 | "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`", | |
958 | "success": true |
|
973 | "success": true | |
959 | } |
|
974 | } | |
960 | error: null |
|
975 | error: null | |
961 |
|
976 | |||
962 |
|
977 | |||
963 | revoke_users_group_permission |
|
978 | revoke_users_group_permission | |
964 | ----------------------------- |
|
979 | ----------------------------- | |
965 |
|
980 | |||
966 | Revoke permission for user group on given repository.This command can be |
|
981 | Revoke permission for user group on given repository.This command can be | |
967 | executed only using api_key belonging to user with admin rights. |
|
982 | executed only using api_key belonging to user with admin rights. | |
968 |
|
983 | |||
969 | INPUT:: |
|
984 | INPUT:: | |
970 |
|
985 | |||
971 | id : <id_for_response> |
|
986 | id : <id_for_response> | |
972 | api_key : "<api_key>" |
|
987 | api_key : "<api_key>" | |
973 | method : "revoke_users_group_permission" |
|
988 | method : "revoke_users_group_permission" | |
974 | args: { |
|
989 | args: { | |
975 | "repoid" : "<reponame or repo_id>" |
|
990 | "repoid" : "<reponame or repo_id>" | |
976 | "usersgroupid" : "<user group id or name>" |
|
991 | "usersgroupid" : "<user group id or name>" | |
977 | } |
|
992 | } | |
978 |
|
993 | |||
979 | OUTPUT:: |
|
994 | OUTPUT:: | |
980 |
|
995 | |||
981 | id : <id_given_in_input> |
|
996 | id : <id_given_in_input> | |
982 | result: { |
|
997 | result: { | |
983 | "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`", |
|
998 | "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`", | |
984 | "success": true |
|
999 | "success": true | |
985 | } |
|
1000 | } | |
986 | error: null |
|
1001 | error: null |
General Comments 0
You need to be logged in to leave comments.
Login now