##// END OF EJS Templates
api.rst edited online with Bitbucket...
Ton Plomp -
r3940:3a608d72 beta
parent child Browse files
Show More
@@ -1,1007 +1,1012 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 : {
215 result : {
216 "repo": "<reponame>",
216 "repo": "<reponame>",
217 "locked": "<bool true|false>",
217 "locked": "<bool true|false>",
218 "locked_since": "<float lock_time>",
218 "locked_since": "<float lock_time>",
219 "locked_by": "<username>",
219 "locked_by": "<username>",
220 "msg": "User `<username>` set lock state for repo `<reponame>` to `<false|true>`"
220 "msg": "User `<username>` set lock state for repo `<reponame>` to `<false|true>`"
221 }
221 }
222 error : null
222 error : null
223
223
224
224
225 show_ip
225 show_ip
226 -------
226 -------
227
227
228 Shows IP address as seen from RhodeCode server, together with all
228 Shows IP address as seen from RhodeCode server, together with all
229 defined IP addresses for given user.
229 defined IP addresses for given user.
230 This command can be executed only using api_key belonging to user with admin
230 This command can be executed only using api_key belonging to user with admin
231 rights.
231 rights.
232
232
233 INPUT::
233 INPUT::
234
234
235 id : <id_for_response>
235 id : <id_for_response>
236 api_key : "<api_key>"
236 api_key : "<api_key>"
237 method : "show_ip"
237 method : "show_ip"
238 args : {
238 args : {
239 "userid" : "<user_id or username>",
239 "userid" : "<user_id or username>",
240 }
240 }
241
241
242 OUTPUT::
242 OUTPUT::
243
243
244 id : <id_given_in_input>
244 id : <id_given_in_input>
245 result : {
245 result : {
246 "ip_addr_server": <ip_from_clien>",
246 "ip_addr_server": <ip_from_clien>",
247 "user_ips": [
247 "user_ips": [
248 {
248 {
249 "ip_addr": "<ip_with_mask>",
249 "ip_addr": "<ip_with_mask>",
250 "ip_range": ["<start_ip>", "<end_ip>"],
250 "ip_range": ["<start_ip>", "<end_ip>"],
251 },
251 },
252 ...
252 ...
253 ]
253 ]
254 }
254 }
255
255
256 error : null
256 error : null
257
257
258
258
259 get_user
259 get_user
260 --------
260 --------
261
261
262 Get's an user by username or user_id, Returns empty result if user is not found.
262 Get's an user by username or user_id, Returns empty result if user is not found.
263 If userid param is skipped it is set to id of user who is calling this method.
263 If userid param is skipped it is set to id of user who is calling this method.
264 This command can be executed only using api_key belonging to user with admin
264 This command can be executed only using api_key belonging to user with admin
265 rights, or regular users that cannot specify different userid than theirs
265 rights, or regular users that cannot specify different userid than theirs
266
266
267
267
268 INPUT::
268 INPUT::
269
269
270 id : <id_for_response>
270 id : <id_for_response>
271 api_key : "<api_key>"
271 api_key : "<api_key>"
272 method : "get_user"
272 method : "get_user"
273 args : {
273 args : {
274 "userid" : "<username or user_id Optional(=apiuser)>"
274 "userid" : "<username or user_id Optional(=apiuser)>"
275 }
275 }
276
276
277 OUTPUT::
277 OUTPUT::
278
278
279 id : <id_given_in_input>
279 id : <id_given_in_input>
280 result: None if user does not exist or
280 result: None if user does not exist or
281 {
281 {
282 "user_id" : "<user_id>",
282 "user_id" : "<user_id>",
283 "api_key" : "<api_key>",
283 "api_key" : "<api_key>",
284 "username" : "<username>",
284 "username" : "<username>",
285 "firstname": "<firstname>",
285 "firstname": "<firstname>",
286 "lastname" : "<lastname>",
286 "lastname" : "<lastname>",
287 "email" : "<email>",
287 "email" : "<email>",
288 "emails": "<list_of_all_additional_emails>",
288 "emails": "<list_of_all_additional_emails>",
289 "ip_addresses": "<list_of_ip_addresses_for_user>",
289 "ip_addresses": "<list_of_ip_addresses_for_user>",
290 "active" : "<bool>",
290 "active" : "<bool>",
291 "admin" :Β  "<bool>",
291 "admin" :Β  "<bool>",
292 "ldap_dn" : "<ldap_dn>",
292 "ldap_dn" : "<ldap_dn>",
293 "last_login": "<last_login>",
293 "last_login": "<last_login>",
294 "permissions": {
294 "permissions": {
295 "global": ["hg.create.repository",
295 "global": ["hg.create.repository",
296 "repository.read",
296 "repository.read",
297 "hg.register.manual_activate"],
297 "hg.register.manual_activate"],
298 "repositories": {"repo1": "repository.none"},
298 "repositories": {"repo1": "repository.none"},
299 "repositories_groups": {"Group1": "group.read"}
299 "repositories_groups": {"Group1": "group.read"}
300 },
300 },
301 }
301 }
302
302
303 error: null
303 error: null
304
304
305
305
306 get_users
306 get_users
307 ---------
307 ---------
308
308
309 Lists all existing users. This command can be executed only using api_key
309 Lists all existing users. This command can be executed only using api_key
310 belonging to user with admin rights.
310 belonging to user with admin rights.
311
311
312
312
313 INPUT::
313 INPUT::
314
314
315 id : <id_for_response>
315 id : <id_for_response>
316 api_key : "<api_key>"
316 api_key : "<api_key>"
317 method : "get_users"
317 method : "get_users"
318 args : { }
318 args : { }
319
319
320 OUTPUT::
320 OUTPUT::
321
321
322 id : <id_given_in_input>
322 id : <id_given_in_input>
323 result: [
323 result: [
324 {
324 {
325 "user_id" : "<user_id>",
325 "user_id" : "<user_id>",
326 "api_key" : "<api_key>",
326 "username" : "<username>",
327 "username" : "<username>",
327 "firstname": "<firstname>",
328 "firstname": "<firstname>",
328 "lastname" : "<lastname>",
329 "lastname" : "<lastname>",
329 "email" : "<email>",
330 "email" : "<email>",
330 "emails": "<list_of_all_additional_emails>",
331 "emails": "<list_of_all_additional_emails>",
331 "ip_addresses": "<list_of_ip_addresses_for_user>",
332 "ip_addresses": "<list_of_ip_addresses_for_user>",
332 "active" : "<bool>",
333 "active" : "<bool>",
333 "admin" :Β  "<bool>",
334 "admin" :Β  "<bool>",
334 "ldap_dn" : "<ldap_dn>",
335 "ldap_dn" : "<ldap_dn>",
335 "last_login": "<last_login>",
336 "last_login": "<last_login>",
336 },
337 },
337 …
338 …
338 ]
339 ]
339 error: null
340 error: null
340
341
341
342
342 create_user
343 create_user
343 -----------
344 -----------
344
345
345 Creates new user. This command can
346 Creates new user. This command can
346 be executed only using api_key belonging to user with admin rights.
347 be executed only using api_key belonging to user with admin rights.
347
348
348
349
349 INPUT::
350 INPUT::
350
351
351 id : <id_for_response>
352 id : <id_for_response>
352 api_key : "<api_key>"
353 api_key : "<api_key>"
353 method : "create_user"
354 method : "create_user"
354 args : {
355 args : {
355 "username" : "<username>",
356 "username" : "<username>",
356 "email" : "<useremail>",
357 "email" : "<useremail>",
357 "password" : "<password = Optional(None)>",
358 "password" : "<password = Optional(None)>",
358 "firstname" : "<firstname> = Optional(None)",
359 "firstname" : "<firstname> = Optional(None)",
359 "lastname" : "<lastname> = Optional(None)",
360 "lastname" : "<lastname> = Optional(None)",
360 "active" : "<bool> = Optional(True)",
361 "active" : "<bool> = Optional(True)",
361 "admin" : "<bool> = Optional(False)",
362 "admin" : "<bool> = Optional(False)",
362 "ldap_dn" : "<ldap_dn> = Optional(None)"
363 "ldap_dn" : "<ldap_dn> = Optional(None)"
363 }
364 }
364
365
365 OUTPUT::
366 OUTPUT::
366
367
367 id : <id_given_in_input>
368 id : <id_given_in_input>
368 result: {
369 result: {
369 "msg" : "created new user `<username>`",
370 "msg" : "created new user `<username>`",
370 "user": {
371 "user": {
371 "user_id" : "<user_id>",
372 "user_id" : "<user_id>",
372 "username" : "<username>",
373 "username" : "<username>",
373 "firstname": "<firstname>",
374 "firstname": "<firstname>",
374 "lastname" : "<lastname>",
375 "lastname" : "<lastname>",
375 "email" : "<email>",
376 "email" : "<email>",
376 "emails": "<list_of_all_additional_emails>",
377 "emails": "<list_of_all_additional_emails>",
377 "active" : "<bool>",
378 "active" : "<bool>",
378 "admin" :Β  "<bool>",
379 "admin" :Β  "<bool>",
379 "ldap_dn" : "<ldap_dn>",
380 "ldap_dn" : "<ldap_dn>",
380 "last_login": "<last_login>",
381 "last_login": "<last_login>",
381 },
382 },
382 }
383 }
383 error: null
384 error: null
384
385
385
386
386 update_user
387 update_user
387 -----------
388 -----------
388
389
389 updates given user if such user exists. This command can
390 updates given user if such user exists. This command can
390 be executed only using api_key belonging to user with admin rights.
391 be executed only using api_key belonging to user with admin rights.
391
392
392
393
393 INPUT::
394 INPUT::
394
395
395 id : <id_for_response>
396 id : <id_for_response>
396 api_key : "<api_key>"
397 api_key : "<api_key>"
397 method : "update_user"
398 method : "update_user"
398 args : {
399 args : {
399 "userid" : "<user_id or username>",
400 "userid" : "<user_id or username>",
400 "username" : "<username> = Optional(None)",
401 "username" : "<username> = Optional(None)",
401 "email" : "<useremail> = Optional(None)",
402 "email" : "<useremail> = Optional(None)",
402 "password" : "<password> = Optional(None)",
403 "password" : "<password> = Optional(None)",
403 "firstname" : "<firstname> = Optional(None)",
404 "firstname" : "<firstname> = Optional(None)",
404 "lastname" : "<lastname> = Optional(None)",
405 "lastname" : "<lastname> = Optional(None)",
405 "active" : "<bool> = Optional(None)",
406 "active" : "<bool> = Optional(None)",
406 "admin" : "<bool> = Optional(None)",
407 "admin" : "<bool> = Optional(None)",
407 "ldap_dn" : "<ldap_dn> = Optional(None)"
408 "ldap_dn" : "<ldap_dn> = Optional(None)"
408 }
409 }
409
410
410 OUTPUT::
411 OUTPUT::
411
412
412 id : <id_given_in_input>
413 id : <id_given_in_input>
413 result: {
414 result: {
414 "msg" : "updated user ID:<userid> <username>",
415 "msg" : "updated user ID:<userid> <username>",
415 "user": {
416 "user": {
416 "user_id" : "<user_id>",
417 "user_id" : "<user_id>",
418 "api_key" : "<api_key>",
417 "username" : "<username>",
419 "username" : "<username>",
418 "firstname": "<firstname>",
420 "firstname": "<firstname>",
419 "lastname" : "<lastname>",
421 "lastname" : "<lastname>",
420 "email" : "<email>",
422 "email" : "<email>",
421 "emails": "<list_of_all_additional_emails>",
423 "emails": "<list_of_all_additional_emails>",
422 "active" : "<bool>",
424 "active" : "<bool>",
423 "admin" :Β  "<bool>",
425 "admin" :Β  "<bool>",
424 "ldap_dn" : "<ldap_dn>",
426 "ldap_dn" : "<ldap_dn>",
425 "last_login": "<last_login>",
427 "last_login": "<last_login>",
426 },
428 },
427 }
429 }
428 error: null
430 error: null
429
431
430
432
431 delete_user
433 delete_user
432 -----------
434 -----------
433
435
434
436
435 deletes givenuser if such user exists. This command can
437 deletes givenuser if such user exists. This command can
436 be executed only using api_key belonging to user with admin rights.
438 be executed only using api_key belonging to user with admin rights.
437
439
438
440
439 INPUT::
441 INPUT::
440
442
441 id : <id_for_response>
443 id : <id_for_response>
442 api_key : "<api_key>"
444 api_key : "<api_key>"
443 method : "delete_user"
445 method : "delete_user"
444 args : {
446 args : {
445 "userid" : "<user_id or username>",
447 "userid" : "<user_id or username>",
446 }
448 }
447
449
448 OUTPUT::
450 OUTPUT::
449
451
450 id : <id_given_in_input>
452 id : <id_given_in_input>
451 result: {
453 result: {
452 "msg" : "deleted user ID:<userid> <username>",
454 "msg" : "deleted user ID:<userid> <username>",
453 "user": null
455 "user": null
454 }
456 }
455 error: null
457 error: null
456
458
457
459
458 get_users_group
460 get_users_group
459 ---------------
461 ---------------
460
462
461 Gets an existing user group. This command can be executed only using api_key
463 Gets an existing user group. This command can be executed only using api_key
462 belonging to user with admin rights.
464 belonging to user with admin rights.
463
465
464
466
465 INPUT::
467 INPUT::
466
468
467 id : <id_for_response>
469 id : <id_for_response>
468 api_key : "<api_key>"
470 api_key : "<api_key>"
469 method : "get_users_group"
471 method : "get_users_group"
470 args : {
472 args : {
471 "usersgroupid" : "<user group id or name>"
473 "usersgroupid" : "<user group id or name>"
472 }
474 }
473
475
474 OUTPUT::
476 OUTPUT::
475
477
476 id : <id_given_in_input>
478 id : <id_given_in_input>
477 result : None if group not exist
479 result : None if group not exist
478 {
480 {
479 "users_group_id" : "<id>",
481 "users_group_id" : "<id>",
480 "group_name" : "<groupname>",
482 "group_name" : "<groupname>",
481 "active": "<bool>",
483 "active": "<bool>",
482 "members" : [
484 "members" : [
483 {
485 {
484 "user_id" : "<user_id>",
486 "user_id" : "<user_id>",
487 "api_key" : "<api_key>",
485 "username" : "<username>",
488 "username" : "<username>",
486 "firstname": "<firstname>",
489 "firstname": "<firstname>",
487 "lastname" : "<lastname>",
490 "lastname" : "<lastname>",
488 "email" : "<email>",
491 "email" : "<email>",
489 "emails": "<list_of_all_additional_emails>",
492 "emails": "<list_of_all_additional_emails>",
490 "active" : "<bool>",
493 "active" : "<bool>",
491 "admin" :Β  "<bool>",
494 "admin" :Β  "<bool>",
492 "ldap_dn" : "<ldap_dn>",
495 "ldap_dn" : "<ldap_dn>",
493 "last_login": "<last_login>",
496 "last_login": "<last_login>",
494 },
497 },
495 …
498 …
496 ]
499 ]
497 }
500 }
498 error : null
501 error : null
499
502
500
503
501 get_users_groups
504 get_users_groups
502 ----------------
505 ----------------
503
506
504 Lists all existing user groups. This command can be executed only using
507 Lists all existing user groups. This command can be executed only using
505 api_key belonging to user with admin rights.
508 api_key belonging to user with admin rights.
506
509
507
510
508 INPUT::
511 INPUT::
509
512
510 id : <id_for_response>
513 id : <id_for_response>
511 api_key : "<api_key>"
514 api_key : "<api_key>"
512 method : "get_users_groups"
515 method : "get_users_groups"
513 args : { }
516 args : { }
514
517
515 OUTPUT::
518 OUTPUT::
516
519
517 id : <id_given_in_input>
520 id : <id_given_in_input>
518 result : [
521 result : [
519 {
522 {
520 "users_group_id" : "<id>",
523 "users_group_id" : "<id>",
521 "group_name" : "<groupname>",
524 "group_name" : "<groupname>",
522 "active": "<bool>",
525 "active": "<bool>",
523 },
526 },
524 …
527 …
525 ]
528 ]
526 error : null
529 error : null
527
530
528
531
529 create_users_group
532 create_users_group
530 ------------------
533 ------------------
531
534
532 Creates new user group. This command can be executed only using api_key
535 Creates new user group. This command can be executed only using api_key
533 belonging to user with admin rights
536 belonging to user with admin rights
534
537
535
538
536 INPUT::
539 INPUT::
537
540
538 id : <id_for_response>
541 id : <id_for_response>
539 api_key : "<api_key>"
542 api_key : "<api_key>"
540 method : "create_users_group"
543 method : "create_users_group"
541 args: {
544 args: {
542 "group_name": "<groupname>",
545 "group_name": "<groupname>",
543 "owner" : "<onwer_name_or_id = Optional(=apiuser)>",
546 "owner" : "<onwer_name_or_id = Optional(=apiuser)>",
544 "active": "<bool> = Optional(True)"
547 "active": "<bool> = Optional(True)"
545 }
548 }
546
549
547 OUTPUT::
550 OUTPUT::
548
551
549 id : <id_given_in_input>
552 id : <id_given_in_input>
550 result: {
553 result: {
551 "msg": "created new user group `<groupname>`",
554 "msg": "created new user group `<groupname>`",
552 "users_group": {
555 "users_group": {
553 "users_group_id" : "<id>",
556 "users_group_id" : "<id>",
554 "group_name" : "<groupname>",
557 "group_name" : "<groupname>",
555 "active": "<bool>",
558 "active": "<bool>",
556 },
559 },
557 }
560 }
558 error: null
561 error: null
559
562
560
563
561 add_user_to_users_group
564 add_user_to_users_group
562 -----------------------
565 -----------------------
563
566
564 Adds a user to a user group. If user exists in that group success will be
567 Adds a user to a user group. If user exists in that group success will be
565 `false`. This command can be executed only using api_key
568 `false`. This command can be executed only using api_key
566 belonging to user with admin rights
569 belonging to user with admin rights
567
570
568
571
569 INPUT::
572 INPUT::
570
573
571 id : <id_for_response>
574 id : <id_for_response>
572 api_key : "<api_key>"
575 api_key : "<api_key>"
573 method : "add_user_users_group"
576 method : "add_user_users_group"
574 args: {
577 args: {
575 "usersgroupid" : "<user group id or name>",
578 "usersgroupid" : "<user group id or name>",
576 "userid" : "<user_id or username>",
579 "userid" : "<user_id or username>",
577 }
580 }
578
581
579 OUTPUT::
582 OUTPUT::
580
583
581 id : <id_given_in_input>
584 id : <id_given_in_input>
582 result: {
585 result: {
583 "success": True|False # depends on if member is in group
586 "success": True|False # depends on if member is in group
584 "msg": "added member `<username>` to user group `<groupname>` |
587 "msg": "added member `<username>` to user group `<groupname>` |
585 User is already in that group"
588 User is already in that group"
586 }
589 }
587 error: null
590 error: null
588
591
589
592
590 remove_user_from_users_group
593 remove_user_from_users_group
591 ----------------------------
594 ----------------------------
592
595
593 Removes a user from a user group. If user is not in given group success will
596 Removes a user from a user group. If user is not in given group success will
594 be `false`. This command can be executed only
597 be `false`. This command can be executed only
595 using api_key belonging to user with admin rights
598 using api_key belonging to user with admin rights
596
599
597
600
598 INPUT::
601 INPUT::
599
602
600 id : <id_for_response>
603 id : <id_for_response>
601 api_key : "<api_key>"
604 api_key : "<api_key>"
602 method : "remove_user_from_users_group"
605 method : "remove_user_from_users_group"
603 args: {
606 args: {
604 "usersgroupid" : "<user group id or name>",
607 "usersgroupid" : "<user group id or name>",
605 "userid" : "<user_id or username>",
608 "userid" : "<user_id or username>",
606 }
609 }
607
610
608 OUTPUT::
611 OUTPUT::
609
612
610 id : <id_given_in_input>
613 id : <id_given_in_input>
611 result: {
614 result: {
612 "success": True|False, # depends on if member is in group
615 "success": True|False, # depends on if member is in group
613 "msg": "removed member <username> from user group <groupname> |
616 "msg": "removed member <username> from user group <groupname> |
614 User wasn't in group"
617 User wasn't in group"
615 }
618 }
616 error: null
619 error: null
617
620
618
621
619 get_repo
622 get_repo
620 --------
623 --------
621
624
622 Gets an existing repository by it's name or repository_id. Members will return
625 Gets an existing repository by it's name or repository_id. Members will return
623 either users_group or user associated to that repository. This command can be
626 either users_group or user associated to that repository. This command can be
624 executed only using api_key belonging to user with admin
627 executed only using api_key belonging to user with admin
625 rights or regular user that have at least read access to repository.
628 rights or regular user that have at least read access to repository.
626
629
627
630
628 INPUT::
631 INPUT::
629
632
630 id : <id_for_response>
633 id : <id_for_response>
631 api_key : "<api_key>"
634 api_key : "<api_key>"
632 method : "get_repo"
635 method : "get_repo"
633 args: {
636 args: {
634 "repoid" : "<reponame or repo_id>"
637 "repoid" : "<reponame or repo_id>"
635 }
638 }
636
639
637 OUTPUT::
640 OUTPUT::
638
641
639 id : <id_given_in_input>
642 id : <id_given_in_input>
640 result: None if repository does not exist or
643 result: None if repository does not exist or
641 {
644 {
642 "repo_id" : "<repo_id>",
645 "repo_id" : "<repo_id>",
643 "repo_name" : "<reponame>"
646 "repo_name" : "<reponame>"
644 "repo_type" : "<repo_type>",
647 "repo_type" : "<repo_type>",
645 "clone_uri" : "<clone_uri>",
648 "clone_uri" : "<clone_uri>",
646 "enable_downloads": "<bool>",
649 "enable_downloads": "<bool>",
647 "enable_locking": "<bool>",
650 "enable_locking": "<bool>",
648 "enable_statistics": "<bool>",
651 "enable_statistics": "<bool>",
649 "private": "<bool>",
652 "private": "<bool>",
650 "created_on" : "<date_time_created>",
653 "created_on" : "<date_time_created>",
651 "description" : "<description>",
654 "description" : "<description>",
652 "landing_rev": "<landing_rev>",
655 "landing_rev": "<landing_rev>",
653 "last_changeset": {
656 "last_changeset": {
654 "author": "<full_author>",
657 "author": "<full_author>",
655 "date": "<date_time_of_commit>",
658 "date": "<date_time_of_commit>",
656 "message": "<commit_message>",
659 "message": "<commit_message>",
657 "raw_id": "<raw_id>",
660 "raw_id": "<raw_id>",
658 "revision": "<numeric_revision>",
661 "revision": "<numeric_revision>",
659 "short_id": "<short_id>"
662 "short_id": "<short_id>"
660 }
663 }
661 "owner": "<repo_owner>",
664 "owner": "<repo_owner>",
662 "fork_of": "<name_of_fork_parent>",
665 "fork_of": "<name_of_fork_parent>",
663 "members" : [
666 "members" : [
664 {
667 {
665 "type": "user",
668 "type": "user",
666 "user_id" : "<user_id>",
669 "user_id" : "<user_id>",
670 "api_key" : "<api_key>",
667 "username" : "<username>",
671 "username" : "<username>",
668 "firstname": "<firstname>",
672 "firstname": "<firstname>",
669 "lastname" : "<lastname>",
673 "lastname" : "<lastname>",
670 "email" : "<email>",
674 "email" : "<email>",
671 "emails": "<list_of_all_additional_emails>",
675 "emails": "<list_of_all_additional_emails>",
672 "active" : "<bool>",
676 "active" : "<bool>",
673 "admin" :Β  "<bool>",
677 "admin" :Β  "<bool>",
674 "ldap_dn" : "<ldap_dn>",
678 "ldap_dn" : "<ldap_dn>",
675 "last_login": "<last_login>",
679 "last_login": "<last_login>",
676 "permission" : "repository.(read|write|admin)"
680 "permission" : "repository.(read|write|admin)"
677 },
681 },
678 …
682 …
679 {
683 {
680 "type": "users_group",
684 "type": "users_group",
681 "id" : "<usersgroupid>",
685 "id" : "<usersgroupid>",
682 "name" : "<usersgroupname>",
686 "name" : "<usersgroupname>",
683 "active": "<bool>",
687 "active": "<bool>",
684 "permission" : "repository.(read|write|admin)"
688 "permission" : "repository.(read|write|admin)"
685 },
689 },
686 …
690 …
687 ]
691 ]
688 "followers": [
692 "followers": [
689 {
693 {
690 "user_id" : "<user_id>",
694 "user_id" : "<user_id>",
691 "username" : "<username>",
695 "username" : "<username>",
696 "api_key" : "<api_key>",
692 "firstname": "<firstname>",
697 "firstname": "<firstname>",
693 "lastname" : "<lastname>",
698 "lastname" : "<lastname>",
694 "email" : "<email>",
699 "email" : "<email>",
695 "emails": "<list_of_all_additional_emails>",
700 "emails": "<list_of_all_additional_emails>",
696 "ip_addresses": "<list_of_ip_addresses_for_user>",
701 "ip_addresses": "<list_of_ip_addresses_for_user>",
697 "active" : "<bool>",
702 "active" : "<bool>",
698 "admin" :Β  "<bool>",
703 "admin" :Β  "<bool>",
699 "ldap_dn" : "<ldap_dn>",
704 "ldap_dn" : "<ldap_dn>",
700 "last_login": "<last_login>",
705 "last_login": "<last_login>",
701 },
706 },
702 …
707 …
703 ]
708 ]
704 }
709 }
705 error: null
710 error: null
706
711
707
712
708 get_repos
713 get_repos
709 ---------
714 ---------
710
715
711 Lists all existing repositories. This command can be executed only using
716 Lists all existing repositories. This command can be executed only using
712 api_key belonging to user with admin rights or regular user that have
717 api_key belonging to user with admin rights or regular user that have
713 admin, write or read access to repository.
718 admin, write or read access to repository.
714
719
715
720
716 INPUT::
721 INPUT::
717
722
718 id : <id_for_response>
723 id : <id_for_response>
719 api_key : "<api_key>"
724 api_key : "<api_key>"
720 method : "get_repos"
725 method : "get_repos"
721 args: { }
726 args: { }
722
727
723 OUTPUT::
728 OUTPUT::
724
729
725 id : <id_given_in_input>
730 id : <id_given_in_input>
726 result: [
731 result: [
727 {
732 {
728 "repo_id" : "<repo_id>",
733 "repo_id" : "<repo_id>",
729 "repo_name" : "<reponame>"
734 "repo_name" : "<reponame>"
730 "repo_type" : "<repo_type>",
735 "repo_type" : "<repo_type>",
731 "clone_uri" : "<clone_uri>",
736 "clone_uri" : "<clone_uri>",
732 "private": : "<bool>",
737 "private": : "<bool>",
733 "created_on" : "<datetimecreated>",
738 "created_on" : "<datetimecreated>",
734 "description" : "<description>",
739 "description" : "<description>",
735 "landing_rev": "<landing_rev>",
740 "landing_rev": "<landing_rev>",
736 "owner": "<repo_owner>",
741 "owner": "<repo_owner>",
737 "fork_of": "<name_of_fork_parent>",
742 "fork_of": "<name_of_fork_parent>",
738 "enable_downloads": "<bool>",
743 "enable_downloads": "<bool>",
739 "enable_locking": "<bool>",
744 "enable_locking": "<bool>",
740 "enable_statistics": "<bool>",
745 "enable_statistics": "<bool>",
741 },
746 },
742 …
747 …
743 ]
748 ]
744 error: null
749 error: null
745
750
746
751
747 get_repo_nodes
752 get_repo_nodes
748 --------------
753 --------------
749
754
750 returns a list of nodes and it's children in a flat list for a given path
755 returns a list of nodes and it's children in a flat list for a given path
751 at given revision. It's possible to specify ret_type to show only `files` or
756 at given revision. It's possible to specify ret_type to show only `files` or
752 `dirs`. This command can be executed only using api_key belonging to user
757 `dirs`. This command can be executed only using api_key belonging to user
753 with admin rights
758 with admin rights
754
759
755
760
756 INPUT::
761 INPUT::
757
762
758 id : <id_for_response>
763 id : <id_for_response>
759 api_key : "<api_key>"
764 api_key : "<api_key>"
760 method : "get_repo_nodes"
765 method : "get_repo_nodes"
761 args: {
766 args: {
762 "repoid" : "<reponame or repo_id>"
767 "repoid" : "<reponame or repo_id>"
763 "revision" : "<revision>",
768 "revision" : "<revision>",
764 "root_path" : "<root_path>",
769 "root_path" : "<root_path>",
765 "ret_type" : "<ret_type> = Optional('all')"
770 "ret_type" : "<ret_type> = Optional('all')"
766 }
771 }
767
772
768 OUTPUT::
773 OUTPUT::
769
774
770 id : <id_given_in_input>
775 id : <id_given_in_input>
771 result: [
776 result: [
772 {
777 {
773 "name" : "<name>"
778 "name" : "<name>"
774 "type" : "<type>",
779 "type" : "<type>",
775 },
780 },
776 …
781 …
777 ]
782 ]
778 error: null
783 error: null
779
784
780
785
781 create_repo
786 create_repo
782 -----------
787 -----------
783
788
784 Creates a repository. If repository name contains "/", all needed repository
789 Creates a repository. If repository name contains "/", all needed repository
785 groups will be created. For example "foo/bar/baz" will create groups
790 groups will be created. For example "foo/bar/baz" will create groups
786 "foo", "bar" (with "foo" as parent), and create "baz" repository with
791 "foo", "bar" (with "foo" as parent), and create "baz" repository with
787 "bar" as group. This command can be executed only using api_key belonging to user with admin
792 "bar" as group. This command can be executed only using api_key belonging to user with admin
788 rights or regular user that have create repository permission. Regular users
793 rights or regular user that have create repository permission. Regular users
789 cannot specify owner parameter
794 cannot specify owner parameter
790
795
791
796
792 INPUT::
797 INPUT::
793
798
794 id : <id_for_response>
799 id : <id_for_response>
795 api_key : "<api_key>"
800 api_key : "<api_key>"
796 method : "create_repo"
801 method : "create_repo"
797 args: {
802 args: {
798 "repo_name" : "<reponame>",
803 "repo_name" : "<reponame>",
799 "owner" : "<onwer_name_or_id = Optional(=apiuser)>",
804 "owner" : "<onwer_name_or_id = Optional(=apiuser)>",
800 "repo_type" : "<repo_type> = Optional('hg')",
805 "repo_type" : "<repo_type> = Optional('hg')",
801 "description" : "<description> = Optional('')",
806 "description" : "<description> = Optional('')",
802 "private" : "<bool> = Optional(False)",
807 "private" : "<bool> = Optional(False)",
803 "clone_uri" : "<clone_uri> = Optional(None)",
808 "clone_uri" : "<clone_uri> = Optional(None)",
804 "landing_rev" : "<landing_rev> = Optional('tip')",
809 "landing_rev" : "<landing_rev> = Optional('tip')",
805 "enable_downloads": "<bool> = Optional(False)",
810 "enable_downloads": "<bool> = Optional(False)",
806 "enable_locking": "<bool> = Optional(False)",
811 "enable_locking": "<bool> = Optional(False)",
807 "enable_statistics": "<bool> = Optional(False)",
812 "enable_statistics": "<bool> = Optional(False)",
808 }
813 }
809
814
810 OUTPUT::
815 OUTPUT::
811
816
812 id : <id_given_in_input>
817 id : <id_given_in_input>
813 result: {
818 result: {
814 "msg": "Created new repository `<reponame>`",
819 "msg": "Created new repository `<reponame>`",
815 "repo": {
820 "repo": {
816 "repo_id" : "<repo_id>",
821 "repo_id" : "<repo_id>",
817 "repo_name" : "<reponame>"
822 "repo_name" : "<reponame>"
818 "repo_type" : "<repo_type>",
823 "repo_type" : "<repo_type>",
819 "clone_uri" : "<clone_uri>",
824 "clone_uri" : "<clone_uri>",
820 "private": : "<bool>",
825 "private": : "<bool>",
821 "created_on" : "<datetimecreated>",
826 "created_on" : "<datetimecreated>",
822 "description" : "<description>",
827 "description" : "<description>",
823 "landing_rev": "<landing_rev>",
828 "landing_rev": "<landing_rev>",
824 "owner": "<username or user_id>",
829 "owner": "<username or user_id>",
825 "fork_of": "<name_of_fork_parent>",
830 "fork_of": "<name_of_fork_parent>",
826 "enable_downloads": "<bool>",
831 "enable_downloads": "<bool>",
827 "enable_locking": "<bool>",
832 "enable_locking": "<bool>",
828 "enable_statistics": "<bool>",
833 "enable_statistics": "<bool>",
829 },
834 },
830 }
835 }
831 error: null
836 error: null
832
837
833
838
834 fork_repo
839 fork_repo
835 ---------
840 ---------
836
841
837 Creates a fork of given repo. In case of using celery this will
842 Creates a fork of given repo. In case of using celery this will
838 immidiatelly return success message, while fork is going to be created
843 immidiatelly return success message, while fork is going to be created
839 asynchronous. This command can be executed only using api_key belonging to
844 asynchronous. This command can be executed only using api_key belonging to
840 user with admin rights or regular user that have fork permission, and at least
845 user with admin rights or regular user that have fork permission, and at least
841 read access to forking repository. Regular users cannot specify owner parameter.
846 read access to forking repository. Regular users cannot specify owner parameter.
842
847
843
848
844 INPUT::
849 INPUT::
845
850
846 id : <id_for_response>
851 id : <id_for_response>
847 api_key : "<api_key>"
852 api_key : "<api_key>"
848 method : "fork_repo"
853 method : "fork_repo"
849 args: {
854 args: {
850 "repoid" : "<reponame or repo_id>",
855 "repoid" : "<reponame or repo_id>",
851 "fork_name": "<forkname>",
856 "fork_name": "<forkname>",
852 "owner": "<username or user_id = Optional(=apiuser)>",
857 "owner": "<username or user_id = Optional(=apiuser)>",
853 "description": "<description>",
858 "description": "<description>",
854 "copy_permissions": "<bool>",
859 "copy_permissions": "<bool>",
855 "private": "<bool>",
860 "private": "<bool>",
856 "landing_rev": "<landing_rev>"
861 "landing_rev": "<landing_rev>"
857
862
858 }
863 }
859
864
860 OUTPUT::
865 OUTPUT::
861
866
862 id : <id_given_in_input>
867 id : <id_given_in_input>
863 result: {
868 result: {
864 "msg": "Created fork of `<reponame>` as `<forkname>`",
869 "msg": "Created fork of `<reponame>` as `<forkname>`",
865 "success": true
870 "success": true
866 }
871 }
867 error: null
872 error: null
868
873
869
874
870 delete_repo
875 delete_repo
871 -----------
876 -----------
872
877
873 Deletes a repository. This command can be executed only using api_key belonging
878 Deletes a repository. This command can be executed only using api_key belonging
874 to user with admin rights or regular user that have admin access to repository.
879 to user with admin rights or regular user that have admin access to repository.
875 When `forks` param is set it's possible to detach or delete forks of deleting
880 When `forks` param is set it's possible to detach or delete forks of deleting
876 repository
881 repository
877
882
878
883
879 INPUT::
884 INPUT::
880
885
881 id : <id_for_response>
886 id : <id_for_response>
882 api_key : "<api_key>"
887 api_key : "<api_key>"
883 method : "delete_repo"
888 method : "delete_repo"
884 args: {
889 args: {
885 "repoid" : "<reponame or repo_id>",
890 "repoid" : "<reponame or repo_id>",
886 "forks" : "`delete` or `detach` = Optional(None)"
891 "forks" : "`delete` or `detach` = Optional(None)"
887 }
892 }
888
893
889 OUTPUT::
894 OUTPUT::
890
895
891 id : <id_given_in_input>
896 id : <id_given_in_input>
892 result: {
897 result: {
893 "msg": "Deleted repository `<reponame>`",
898 "msg": "Deleted repository `<reponame>`",
894 "success": true
899 "success": true
895 }
900 }
896 error: null
901 error: null
897
902
898
903
899 grant_user_permission
904 grant_user_permission
900 ---------------------
905 ---------------------
901
906
902 Grant permission for user on given repository, or update existing one
907 Grant permission for user on given repository, or update existing one
903 if found. This command can be executed only using api_key belonging to user
908 if found. This command can be executed only using api_key belonging to user
904 with admin rights.
909 with admin rights.
905
910
906
911
907 INPUT::
912 INPUT::
908
913
909 id : <id_for_response>
914 id : <id_for_response>
910 api_key : "<api_key>"
915 api_key : "<api_key>"
911 method : "grant_user_permission"
916 method : "grant_user_permission"
912 args: {
917 args: {
913 "repoid" : "<reponame or repo_id>"
918 "repoid" : "<reponame or repo_id>"
914 "userid" : "<username or user_id>"
919 "userid" : "<username or user_id>"
915 "perm" : "(repository.(none|read|write|admin))",
920 "perm" : "(repository.(none|read|write|admin))",
916 }
921 }
917
922
918 OUTPUT::
923 OUTPUT::
919
924
920 id : <id_given_in_input>
925 id : <id_given_in_input>
921 result: {
926 result: {
922 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
927 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
923 "success": true
928 "success": true
924 }
929 }
925 error: null
930 error: null
926
931
927
932
928 revoke_user_permission
933 revoke_user_permission
929 ----------------------
934 ----------------------
930
935
931 Revoke permission for user on given repository. This command can be executed
936 Revoke permission for user on given repository. This command can be executed
932 only using api_key belonging to user with admin rights.
937 only using api_key belonging to user with admin rights.
933
938
934
939
935 INPUT::
940 INPUT::
936
941
937 id : <id_for_response>
942 id : <id_for_response>
938 api_key : "<api_key>"
943 api_key : "<api_key>"
939 method : "revoke_user_permission"
944 method : "revoke_user_permission"
940 args: {
945 args: {
941 "repoid" : "<reponame or repo_id>"
946 "repoid" : "<reponame or repo_id>"
942 "userid" : "<username or user_id>"
947 "userid" : "<username or user_id>"
943 }
948 }
944
949
945 OUTPUT::
950 OUTPUT::
946
951
947 id : <id_given_in_input>
952 id : <id_given_in_input>
948 result: {
953 result: {
949 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
954 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
950 "success": true
955 "success": true
951 }
956 }
952 error: null
957 error: null
953
958
954
959
955 grant_users_group_permission
960 grant_users_group_permission
956 ----------------------------
961 ----------------------------
957
962
958 Grant permission for user group on given repository, or update
963 Grant permission for user group on given repository, or update
959 existing one if found. This command can be executed only using
964 existing one if found. This command can be executed only using
960 api_key belonging to user with admin rights.
965 api_key belonging to user with admin rights.
961
966
962
967
963 INPUT::
968 INPUT::
964
969
965 id : <id_for_response>
970 id : <id_for_response>
966 api_key : "<api_key>"
971 api_key : "<api_key>"
967 method : "grant_users_group_permission"
972 method : "grant_users_group_permission"
968 args: {
973 args: {
969 "repoid" : "<reponame or repo_id>"
974 "repoid" : "<reponame or repo_id>"
970 "usersgroupid" : "<user group id or name>"
975 "usersgroupid" : "<user group id or name>"
971 "perm" : "(repository.(none|read|write|admin))",
976 "perm" : "(repository.(none|read|write|admin))",
972 }
977 }
973
978
974 OUTPUT::
979 OUTPUT::
975
980
976 id : <id_given_in_input>
981 id : <id_given_in_input>
977 result: {
982 result: {
978 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
983 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
979 "success": true
984 "success": true
980 }
985 }
981 error: null
986 error: null
982
987
983
988
984 revoke_users_group_permission
989 revoke_users_group_permission
985 -----------------------------
990 -----------------------------
986
991
987 Revoke permission for user group on given repository.This command can be
992 Revoke permission for user group on given repository.This command can be
988 executed only using api_key belonging to user with admin rights.
993 executed only using api_key belonging to user with admin rights.
989
994
990 INPUT::
995 INPUT::
991
996
992 id : <id_for_response>
997 id : <id_for_response>
993 api_key : "<api_key>"
998 api_key : "<api_key>"
994 method : "revoke_users_group_permission"
999 method : "revoke_users_group_permission"
995 args: {
1000 args: {
996 "repoid" : "<reponame or repo_id>"
1001 "repoid" : "<reponame or repo_id>"
997 "usersgroupid" : "<user group id or name>"
1002 "usersgroupid" : "<user group id or name>"
998 }
1003 }
999
1004
1000 OUTPUT::
1005 OUTPUT::
1001
1006
1002 id : <id_given_in_input>
1007 id : <id_given_in_input>
1003 result: {
1008 result: {
1004 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
1009 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
1005 "success": true
1010 "success": true
1006 }
1011 }
1007 error: null
1012 error: null
General Comments 0
You need to be logged in to leave comments. Login now