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