##// END OF EJS Templates
docs: minor fixes for API documentation
Mads Kiilerich -
r8754:2244eb82 stable
parent child Browse files
Show More
@@ -1,1249 +1,1249 b''
1 .. _api:
1 .. _api:
2
2
3 ===
3 ===
4 API
4 API
5 ===
5 ===
6
6
7 Kallithea has a simple JSON RPC API with a single schema for calling all API
7 Kallithea has a simple JSON RPC API with a single schema for calling all API
8 methods. Everything is available by sending JSON encoded http(s) requests to
8 methods. Everything is available by sending JSON encoded http(s) requests to
9 ``<your_server>/_admin/api``.
9 ``<your_server>/_admin/api``.
10
10
11
11
12 API keys
12 API keys
13 --------
13 --------
14
14
15 Every Kallithea user automatically receives an API key, which they can
15 Every Kallithea user automatically receives an API key, which they can
16 view under "My Account". On this page, API keys can also be revoked, and
16 view under "My Account". On this page, API keys can also be revoked, and
17 additional API keys can be generated.
17 additional API keys can be generated.
18
18
19
19
20 API access
20 API access
21 ----------
21 ----------
22
22
23 Clients must send JSON encoded JSON-RPC requests::
23 Clients must send JSON encoded JSON-RPC requests::
24
24
25 {
25 {
26 "id: "<id>",
26 "id": "<id>",
27 "api_key": "<api_key>",
27 "api_key": "<api_key>",
28 "method": "<method_name>",
28 "method": "<method_name>",
29 "args": {"<arg_key>": "<arg_val>"}
29 "args": {"<arg_key>": "<arg_val>"}
30 }
30 }
31
31
32 For example, to pull to a local "CPython" mirror using curl::
32 For example, to pull to a local "CPython" mirror using curl::
33
33
34 curl https://kallithea.example.com/_admin/api -X POST -H 'content-type:text/plain' \
34 curl https://kallithea.example.com/_admin/api -X POST -H 'content-type:text/plain' \
35 --data-binary '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repoid":"CPython"}}'
35 --data-binary '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repoid":"CPython"}}'
36
36
37 In general, provide
37 In general, provide
38 - *id*, a value of any type, can be used to match the response with the request that it is replying to.
38 - *id*, a value of any type, can be used to match the response with the request that it is replying to.
39 - *api_key*, for authentication and permission validation.
39 - *api_key*, for authentication and permission validation.
40 - *method*, the name of the method to call -- a list of available methods can be found below.
40 - *method*, the name of the method to call -- a list of available methods can be found below.
41 - *args*, the arguments to pass to the method.
41 - *args*, the arguments to pass to the method.
42
42
43 .. note::
43 .. note::
44
44
45 api_key can be found or set on the user account page.
45 api_key can be found or set on the user account page.
46
46
47 The response to the JSON-RPC API call will always be a JSON structure::
47 The response to the JSON-RPC API call will always be a JSON structure::
48
48
49 {
49 {
50 "id": <id>, # the id that was used in the request
50 "id": <id>, # the id that was used in the request
51 "result": <result>|null, # JSON formatted result (null on error)
51 "result": <result>|null, # JSON formatted result (null on error)
52 "error": null|<error_message> # JSON formatted error (null on success)
52 "error": null|<error_message> # JSON formatted error (null on success)
53 }
53 }
54
54
55 All responses from the API will be ``HTTP/1.0 200 OK``. If an error occurs,
55 All responses from the API will be ``HTTP/1.0 200 OK``. If an error occurs,
56 the reponse will have a failure description in *error* and
56 the reponse will have a failure description in *error* and
57 *result* will be null.
57 *result* will be null.
58
58
59
59
60 API client
60 API client
61 ----------
61 ----------
62
62
63 Kallithea comes with a ``kallithea-api`` command line tool, providing a convenient
63 Kallithea comes with a ``kallithea-api`` command line tool, providing a convenient
64 way to call the JSON-RPC API.
64 way to call the JSON-RPC API.
65
65
66 For example, to call ``get_repo``::
66 For example, to call ``get_repo``::
67
67
68 kallithea-api --apihost=<Kallithea URL> --apikey=<API key> get_repo
68 kallithea-api --apihost=<Kallithea URL> --apikey=<API key> get_repo
69
69
70 Calling method get_repo => <Kallithea URL>
70 Calling method get_repo => <Kallithea URL>
71 Server response
71 Server response
72 ERROR:"Missing non optional `repoid` arg in JSON DATA"
72 ERROR:"Missing non optional `repoid` arg in JSON DATA"
73
73
74 Oops, looks like we forgot to add an argument. Let's try again, now
74 Oops, looks like we forgot to add an argument. Let's try again, now
75 providing the ``repoid`` as a parameter::
75 providing the ``repoid`` as a parameter::
76
76
77 kallithea-api --apihost=<Kallithea URL> --apikey=<API key> get_repo repoid:myrepo
77 kallithea-api --apihost=<Kallithea URL> --apikey=<API key> get_repo repoid:myrepo
78
78
79 Calling method get_repo => <Kallithea URL>
79 Calling method get_repo => <Kallithea URL>
80 Server response
80 Server response
81 {
81 {
82 "clone_uri": null,
82 "clone_uri": null,
83 "created_on": "2015-08-31T14:55:19.042",
83 "created_on": "2015-08-31T14:55:19.042",
84 ...
84 ...
85
85
86 To avoid specifying ``apihost`` and ``apikey`` every time, run::
86 To avoid specifying ``apihost`` and ``apikey`` every time, run::
87
87
88 kallithea-api --save-config --apihost=<Kallithea URL> --apikey=<API key>
88 kallithea-api --save-config --apihost=<Kallithea URL> --apikey=<API key>
89
89
90 This will create a ``~/.config/kallithea`` with the specified URL and API key
90 This will create a ``~/.config/kallithea`` with the specified URL and API key
91 so you don't have to specify them every time.
91 so you don't have to specify them every time.
92
92
93
93
94 API methods
94 API methods
95 -----------
95 -----------
96
96
97
97
98 pull
98 pull
99 ^^^^
99 ^^^^
100
100
101 Pull the given repo from remote location. Can be used to automatically keep
101 Pull the given repo from remote location. Can be used to automatically keep
102 remote repos up to date.
102 remote repos up to date.
103 This command can only be executed using the api_key of a user with admin rights.
103 This command can only be executed using the api_key of a user with admin rights.
104
104
105 INPUT::
105 INPUT::
106
106
107 id : <id_for_response>
107 id : <id_for_response>
108 api_key : "<api_key>"
108 api_key : "<api_key>"
109 method : "pull"
109 method : "pull"
110 args : {
110 args : {
111 "repoid" : "<reponame or repo_id>"
111 "repoid" : "<reponame or repo_id>"
112 }
112 }
113
113
114 OUTPUT::
114 OUTPUT::
115
115
116 id : <id_given_in_input>
116 id : <id_given_in_input>
117 result : "Pulled from `<reponame>`"
117 result : "Pulled from `<reponame>`"
118 error : null
118 error : null
119
119
120 rescan_repos
120 rescan_repos
121 ^^^^^^^^^^^^
121 ^^^^^^^^^^^^
122
122
123 Rescan repositories. If ``remove_obsolete`` is set,
123 Rescan repositories. If ``remove_obsolete`` is set,
124 Kallithea will delete repos that are in the database but not in the filesystem.
124 Kallithea will delete repos that are in the database but not in the filesystem.
125 This command can only be executed using the api_key of a user with admin rights.
125 This command can only be executed using the api_key of a user with admin rights.
126
126
127 INPUT::
127 INPUT::
128
128
129 id : <id_for_response>
129 id : <id_for_response>
130 api_key : "<api_key>"
130 api_key : "<api_key>"
131 method : "rescan_repos"
131 method : "rescan_repos"
132 args : {
132 args : {
133 "remove_obsolete" : "<boolean = Optional(False)>"
133 "remove_obsolete" : "<boolean = Optional(False)>"
134 }
134 }
135
135
136 OUTPUT::
136 OUTPUT::
137
137
138 id : <id_given_in_input>
138 id : <id_given_in_input>
139 result : "{'added': [<list of names of added repos>],
139 result : "{'added': [<list of names of added repos>],
140 'removed': [<list of names of removed repos>]}"
140 'removed': [<list of names of removed repos>]}"
141 error : null
141 error : null
142
142
143 invalidate_cache
143 invalidate_cache
144 ^^^^^^^^^^^^^^^^
144 ^^^^^^^^^^^^^^^^
145
145
146 Invalidate the cache for a repository.
146 Invalidate the cache for a repository.
147 This command can only be executed using the api_key of a user with admin rights,
147 This command can only be executed using the api_key of a user with admin rights,
148 or that of a regular user with admin or write access to the repository.
148 or that of a regular user with admin or write access to the repository.
149
149
150 INPUT::
150 INPUT::
151
151
152 id : <id_for_response>
152 id : <id_for_response>
153 api_key : "<api_key>"
153 api_key : "<api_key>"
154 method : "invalidate_cache"
154 method : "invalidate_cache"
155 args : {
155 args : {
156 "repoid" : "<reponame or repo_id>"
156 "repoid" : "<reponame or repo_id>"
157 }
157 }
158
158
159 OUTPUT::
159 OUTPUT::
160
160
161 id : <id_given_in_input>
161 id : <id_given_in_input>
162 result : "Caches of repository `<reponame>`"
162 result : "Caches of repository `<reponame>`"
163 error : null
163 error : null
164
164
165 get_ip
165 get_ip
166 ^^^^^^
166 ^^^^^^
167
167
168 Return IP address as seen from Kallithea server, together with all
168 Return IP address as seen from Kallithea server, together with all
169 defined IP addresses for given user.
169 defined IP addresses for given user.
170 This command can only be executed using the api_key of a user with admin rights.
170 This command can only be executed using the api_key of a user with admin rights.
171
171
172 INPUT::
172 INPUT::
173
173
174 id : <id_for_response>
174 id : <id_for_response>
175 api_key : "<api_key>"
175 api_key : "<api_key>"
176 method : "get_ip"
176 method : "get_ip"
177 args : {
177 args : {
178 "userid" : "<user_id or username>"
178 "userid" : "<user_id or username>"
179 }
179 }
180
180
181 OUTPUT::
181 OUTPUT::
182
182
183 id : <id_given_in_input>
183 id : <id_given_in_input>
184 result : {
184 result : {
185 "ip_addr_server" : <ip_from_client>",
185 "ip_addr_server" : <ip_from_client>",
186 "user_ips" : [
186 "user_ips" : [
187 {
187 {
188 "ip_addr" : "<ip_with_mask>",
188 "ip_addr" : "<ip_with_mask>",
189 "ip_range" : ["<start_ip>", "<end_ip>"]
189 "ip_range" : ["<start_ip>", "<end_ip>"]
190 },
190 },
191 ...
191 ...
192 ]
192 ]
193 }
193 }
194 error : null
194 error : null
195
195
196 get_user
196 get_user
197 ^^^^^^^^
197 ^^^^^^^^
198
198
199 Get a user by username or userid. The result is empty if user can't be found.
199 Get a user by username or userid. The result is empty if user can't be found.
200 If userid param is skipped, it is set to id of user who is calling this method.
200 If userid param is skipped, it is set to id of user who is calling this method.
201 Any userid can be specified when the command is executed using the api_key of a user with admin rights.
201 Any userid can be specified when the command is executed using the api_key of a user with admin rights.
202 Regular users can only specify their own userid.
202 Regular users can only specify their own userid.
203
203
204 INPUT::
204 INPUT::
205
205
206 id : <id_for_response>
206 id : <id_for_response>
207 api_key : "<api_key>"
207 api_key : "<api_key>"
208 method : "get_user"
208 method : "get_user"
209 args : {
209 args : {
210 "userid" : "<username or user_id Optional(=apiuser)>"
210 "userid" : "<username or user_id Optional(=apiuser)>"
211 }
211 }
212
212
213 OUTPUT::
213 OUTPUT::
214
214
215 id : <id_given_in_input>
215 id : <id_given_in_input>
216 result : None if user does not exist or
216 result : None if user does not exist or
217 {
217 {
218 "user_id" : "<user_id>",
218 "user_id" : "<user_id>",
219 "api_key" : "<api_key>",
219 "api_key" : "<api_key>",
220 "username" : "<username>",
220 "username" : "<username>",
221 "firstname" : "<firstname>",
221 "firstname" : "<firstname>",
222 "lastname" : "<lastname>",
222 "lastname" : "<lastname>",
223 "email" : "<email>",
223 "email" : "<email>",
224 "emails" : "<list_of_all_additional_emails>",
224 "emails" : "<list_of_all_additional_emails>",
225 "ip_addresses": "<list_of_ip_addresses_for_user>",
225 "ip_addresses": "<list_of_ip_addresses_for_user>",
226 "active" : "<bool>",
226 "active" : "<bool>",
227 "admin" : "<bool>",
227 "admin" : "<bool>",
228 "ldap_dn" : "<ldap_dn>",
228 "ldap_dn" : "<ldap_dn>",
229 "last_login" : "<last_login>",
229 "last_login" : "<last_login>",
230 "permissions": {
230 "permissions": {
231 "global": ["hg.create.repository",
231 "global": ["hg.create.repository",
232 "repository.read",
232 "repository.read",
233 "hg.register.manual_activate"],
233 "hg.register.manual_activate"],
234 "repositories" : {"repo1" : "repository.none"},
234 "repositories" : {"repo1" : "repository.none"},
235 "repositories_groups" : {"Group1" : "group.read"}
235 "repositories_groups" : {"Group1" : "group.read"}
236 }
236 }
237 }
237 }
238 error : null
238 error : null
239
239
240 get_users
240 get_users
241 ^^^^^^^^^
241 ^^^^^^^^^
242
242
243 List all existing users.
243 List all existing users.
244 This command can only be executed using the api_key of a user with admin rights.
244 This command can only be executed using the api_key of a user with admin rights.
245
245
246 INPUT::
246 INPUT::
247
247
248 id : <id_for_response>
248 id : <id_for_response>
249 api_key : "<api_key>"
249 api_key : "<api_key>"
250 method : "get_users"
250 method : "get_users"
251 args : { }
251 args : { }
252
252
253 OUTPUT::
253 OUTPUT::
254
254
255 id : <id_given_in_input>
255 id : <id_given_in_input>
256 result : [
256 result : [
257 {
257 {
258 "user_id" : "<user_id>",
258 "user_id" : "<user_id>",
259 "api_key" : "<api_key>",
259 "api_key" : "<api_key>",
260 "username" : "<username>",
260 "username" : "<username>",
261 "firstname" : "<firstname>",
261 "firstname" : "<firstname>",
262 "lastname" : "<lastname>",
262 "lastname" : "<lastname>",
263 "email" : "<email>",
263 "email" : "<email>",
264 "emails" : "<list_of_all_additional_emails>",
264 "emails" : "<list_of_all_additional_emails>",
265 "ip_addresses": "<list_of_ip_addresses_for_user>",
265 "ip_addresses": "<list_of_ip_addresses_for_user>",
266 "active" : "<bool>",
266 "active" : "<bool>",
267 "admin" : "<bool>",
267 "admin" : "<bool>",
268 "ldap_dn" : "<ldap_dn>",
268 "ldap_dn" : "<ldap_dn>",
269 "last_login" : "<last_login>"
269 "last_login" : "<last_login>"
270 },
270 },
271 …
271 …
272 ]
272 ]
273 error : null
273 error : null
274
274
275 .. _create-user:
275 .. _create-user:
276
276
277 create_user
277 create_user
278 ^^^^^^^^^^^
278 ^^^^^^^^^^^
279
279
280 Create new user.
280 Create new user.
281 This command can only be executed using the api_key of a user with admin rights.
281 This command can only be executed using the api_key of a user with admin rights.
282
282
283 INPUT::
283 INPUT::
284
284
285 id : <id_for_response>
285 id : <id_for_response>
286 api_key : "<api_key>"
286 api_key : "<api_key>"
287 method : "create_user"
287 method : "create_user"
288 args : {
288 args : {
289 "username" : "<username>",
289 "username" : "<username>",
290 "email" : "<useremail>",
290 "email" : "<useremail>",
291 "password" : "<password = Optional(None)>",
291 "password" : "<password = Optional(None)>",
292 "firstname" : "<firstname> = Optional(None)",
292 "firstname" : "<firstname> = Optional(None)",
293 "lastname" : "<lastname> = Optional(None)",
293 "lastname" : "<lastname> = Optional(None)",
294 "active" : "<bool> = Optional(True)",
294 "active" : "<bool> = Optional(True)",
295 "admin" : "<bool> = Optional(False)",
295 "admin" : "<bool> = Optional(False)",
296 "ldap_dn" : "<ldap_dn> = Optional(None)"
296 "ldap_dn" : "<ldap_dn> = Optional(None)"
297 }
297 }
298
298
299 OUTPUT::
299 OUTPUT::
300
300
301 id : <id_given_in_input>
301 id : <id_given_in_input>
302 result : {
302 result : {
303 "msg" : "created new user `<username>`",
303 "msg" : "created new user `<username>`",
304 "user" : {
304 "user" : {
305 "user_id" : "<user_id>",
305 "user_id" : "<user_id>",
306 "username" : "<username>",
306 "username" : "<username>",
307 "firstname": "<firstname>",
307 "firstname": "<firstname>",
308 "lastname" : "<lastname>",
308 "lastname" : "<lastname>",
309 "email" : "<email>",
309 "email" : "<email>",
310 "emails" : "<list_of_all_additional_emails>",
310 "emails" : "<list_of_all_additional_emails>",
311 "active" : "<bool>",
311 "active" : "<bool>",
312 "admin" : "<bool>",
312 "admin" : "<bool>",
313 "ldap_dn" : "<ldap_dn>",
313 "ldap_dn" : "<ldap_dn>",
314 "last_login": "<last_login>"
314 "last_login": "<last_login>"
315 }
315 }
316 }
316 }
317 error : null
317 error : null
318
318
319 Example::
319 Example::
320
320
321 kallithea-api create_user username:bent email:bent@example.com firstname:Bent lastname:Bentsen extern_type:ldap extern_name:uid=bent,dc=example,dc=com
321 kallithea-api create_user username:bent email:bent@example.com firstname:Bent lastname:Bentsen extern_type:ldap extern_name:uid=bent,dc=example,dc=com
322
322
323 update_user
323 update_user
324 ^^^^^^^^^^^
324 ^^^^^^^^^^^
325
325
326 Update the given user if such user exists.
326 Update the given user if such user exists.
327 This command can only be executed using the api_key of a user with admin rights.
327 This command can only be executed using the api_key of a user with admin rights.
328
328
329 INPUT::
329 INPUT::
330
330
331 id : <id_for_response>
331 id : <id_for_response>
332 api_key : "<api_key>"
332 api_key : "<api_key>"
333 method : "update_user"
333 method : "update_user"
334 args : {
334 args : {
335 "userid" : "<user_id or username>",
335 "userid" : "<user_id or username>",
336 "username" : "<username> = Optional(None)",
336 "username" : "<username> = Optional(None)",
337 "email" : "<useremail> = Optional(None)",
337 "email" : "<useremail> = Optional(None)",
338 "password" : "<password> = Optional(None)",
338 "password" : "<password> = Optional(None)",
339 "firstname" : "<firstname> = Optional(None)",
339 "firstname" : "<firstname> = Optional(None)",
340 "lastname" : "<lastname> = Optional(None)",
340 "lastname" : "<lastname> = Optional(None)",
341 "active" : "<bool> = Optional(None)",
341 "active" : "<bool> = Optional(None)",
342 "admin" : "<bool> = Optional(None)",
342 "admin" : "<bool> = Optional(None)",
343 "ldap_dn" : "<ldap_dn> = Optional(None)"
343 "ldap_dn" : "<ldap_dn> = Optional(None)"
344 }
344 }
345
345
346 OUTPUT::
346 OUTPUT::
347
347
348 id : <id_given_in_input>
348 id : <id_given_in_input>
349 result : {
349 result : {
350 "msg" : "updated user ID:<userid> <username>",
350 "msg" : "updated user ID:<userid> <username>",
351 "user" : {
351 "user" : {
352 "user_id" : "<user_id>",
352 "user_id" : "<user_id>",
353 "api_key" : "<api_key>",
353 "api_key" : "<api_key>",
354 "username" : "<username>",
354 "username" : "<username>",
355 "firstname": "<firstname>",
355 "firstname": "<firstname>",
356 "lastname" : "<lastname>",
356 "lastname" : "<lastname>",
357 "email" : "<email>",
357 "email" : "<email>",
358 "emails" : "<list_of_all_additional_emails>",
358 "emails" : "<list_of_all_additional_emails>",
359 "active" : "<bool>",
359 "active" : "<bool>",
360 "admin" : "<bool>",
360 "admin" : "<bool>",
361 "ldap_dn" : "<ldap_dn>",
361 "ldap_dn" : "<ldap_dn>",
362 "last_login": "<last_login>"
362 "last_login": "<last_login>"
363 }
363 }
364 }
364 }
365 error : null
365 error : null
366
366
367 delete_user
367 delete_user
368 ^^^^^^^^^^^
368 ^^^^^^^^^^^
369
369
370 Delete the given user if such a user exists.
370 Delete the given user if such a user exists.
371 This command can only be executed using the api_key of a user with admin rights.
371 This command can only be executed using the api_key of a user with admin rights.
372
372
373 INPUT::
373 INPUT::
374
374
375 id : <id_for_response>
375 id : <id_for_response>
376 api_key : "<api_key>"
376 api_key : "<api_key>"
377 method : "delete_user"
377 method : "delete_user"
378 args : {
378 args : {
379 "userid" : "<user_id or username>"
379 "userid" : "<user_id or username>"
380 }
380 }
381
381
382 OUTPUT::
382 OUTPUT::
383
383
384 id : <id_given_in_input>
384 id : <id_given_in_input>
385 result : {
385 result : {
386 "msg" : "deleted user ID:<userid> <username>",
386 "msg" : "deleted user ID:<userid> <username>",
387 "user" : null
387 "user" : null
388 }
388 }
389 error : null
389 error : null
390
390
391 get_user_group
391 get_user_group
392 ^^^^^^^^^^^^^^
392 ^^^^^^^^^^^^^^
393
393
394 Get an existing user group.
394 Get an existing user group.
395 This command can only be executed using the api_key of a user with admin rights.
395 This command can only be executed using the api_key of a user with admin rights.
396
396
397 INPUT::
397 INPUT::
398
398
399 id : <id_for_response>
399 id : <id_for_response>
400 api_key : "<api_key>"
400 api_key : "<api_key>"
401 method : "get_user_group"
401 method : "get_user_group"
402 args : {
402 args : {
403 "usergroupid" : "<user group id or name>"
403 "usergroupid" : "<user group id or name>"
404 }
404 }
405
405
406 OUTPUT::
406 OUTPUT::
407
407
408 id : <id_given_in_input>
408 id : <id_given_in_input>
409 result : None if group not exist
409 result : None if group not exist
410 {
410 {
411 "users_group_id" : "<id>",
411 "users_group_id" : "<id>",
412 "group_name" : "<groupname>",
412 "group_name" : "<groupname>",
413 "active" : "<bool>",
413 "active" : "<bool>",
414 "members" : [
414 "members" : [
415 {
415 {
416 "user_id" : "<user_id>",
416 "user_id" : "<user_id>",
417 "api_key" : "<api_key>",
417 "api_key" : "<api_key>",
418 "username" : "<username>",
418 "username" : "<username>",
419 "firstname": "<firstname>",
419 "firstname": "<firstname>",
420 "lastname" : "<lastname>",
420 "lastname" : "<lastname>",
421 "email" : "<email>",
421 "email" : "<email>",
422 "emails" : "<list_of_all_additional_emails>",
422 "emails" : "<list_of_all_additional_emails>",
423 "active" : "<bool>",
423 "active" : "<bool>",
424 "admin" : "<bool>",
424 "admin" : "<bool>",
425 "ldap_dn" : "<ldap_dn>",
425 "ldap_dn" : "<ldap_dn>",
426 "last_login": "<last_login>"
426 "last_login": "<last_login>"
427 },
427 },
428 …
428 …
429 ]
429 ]
430 }
430 }
431 error : null
431 error : null
432
432
433 get_user_groups
433 get_user_groups
434 ^^^^^^^^^^^^^^^
434 ^^^^^^^^^^^^^^^
435
435
436 List all existing user groups.
436 List all existing user groups.
437 This command can only be executed using the api_key of a user with admin rights.
437 This command can only be executed using the api_key of a user with admin rights.
438
438
439 INPUT::
439 INPUT::
440
440
441 id : <id_for_response>
441 id : <id_for_response>
442 api_key : "<api_key>"
442 api_key : "<api_key>"
443 method : "get_user_groups"
443 method : "get_user_groups"
444 args : { }
444 args : { }
445
445
446 OUTPUT::
446 OUTPUT::
447
447
448 id : <id_given_in_input>
448 id : <id_given_in_input>
449 result : [
449 result : [
450 {
450 {
451 "users_group_id" : "<id>",
451 "users_group_id" : "<id>",
452 "group_name" : "<groupname>",
452 "group_name" : "<groupname>",
453 "active" : "<bool>"
453 "active" : "<bool>"
454 },
454 },
455 …
455 …
456 ]
456 ]
457 error : null
457 error : null
458
458
459 create_user_group
459 create_user_group
460 ^^^^^^^^^^^^^^^^^
460 ^^^^^^^^^^^^^^^^^
461
461
462 Create a new user group.
462 Create a new user group.
463 This command can only be executed using the api_key of a user with admin rights.
463 This command can only be executed using the api_key of a user with admin rights.
464
464
465 INPUT::
465 INPUT::
466
466
467 id : <id_for_response>
467 id : <id_for_response>
468 api_key : "<api_key>"
468 api_key : "<api_key>"
469 method : "create_user_group"
469 method : "create_user_group"
470 args : {
470 args : {
471 "group_name": "<groupname>",
471 "group_name": "<groupname>",
472 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
472 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
473 "active" : "<bool> = Optional(True)"
473 "active" : "<bool> = Optional(True)"
474 }
474 }
475
475
476 OUTPUT::
476 OUTPUT::
477
477
478 id : <id_given_in_input>
478 id : <id_given_in_input>
479 result : {
479 result : {
480 "msg" : "created new user group `<groupname>`",
480 "msg" : "created new user group `<groupname>`",
481 "users_group" : {
481 "users_group" : {
482 "users_group_id" : "<id>",
482 "users_group_id" : "<id>",
483 "group_name" : "<groupname>",
483 "group_name" : "<groupname>",
484 "active" : "<bool>"
484 "active" : "<bool>"
485 }
485 }
486 }
486 }
487 error : null
487 error : null
488
488
489 add_user_to_user_group
489 add_user_to_user_group
490 ^^^^^^^^^^^^^^^^^^^^^^
490 ^^^^^^^^^^^^^^^^^^^^^^
491
491
492 Adds a user to a user group. If the user already is in that group, success will be
492 Add a user to a user group. If the user already is in that group, success will be
493 ``false``.
493 ``false``.
494 This command can only be executed using the api_key of a user with admin rights.
494 This command can only be executed using the api_key of a user with admin rights.
495
495
496 INPUT::
496 INPUT::
497
497
498 id : <id_for_response>
498 id : <id_for_response>
499 api_key : "<api_key>"
499 api_key : "<api_key>"
500 method : "add_user_user_group"
500 method : "add_user_user_group"
501 args : {
501 args : {
502 "usersgroupid" : "<user group id or name>",
502 "usersgroupid" : "<user group id or name>",
503 "userid" : "<user_id or username>"
503 "userid" : "<user_id or username>"
504 }
504 }
505
505
506 OUTPUT::
506 OUTPUT::
507
507
508 id : <id_given_in_input>
508 id : <id_given_in_input>
509 result : {
509 result : {
510 "success" : True|False, # depends on if member is in group
510 "success" : True|False, # depends on if member is in group
511 "msg" : "added member `<username>` to a user group `<groupname>` |
511 "msg" : "added member `<username>` to a user group `<groupname>` |
512 User is already in that group"
512 User is already in that group"
513 }
513 }
514 error : null
514 error : null
515
515
516 remove_user_from_user_group
516 remove_user_from_user_group
517 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
517 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
518
518
519 Remove a user from a user group. If the user isn't in the given group, success will
519 Remove a user from a user group. If the user isn't in the given group, success will
520 be ``false``.
520 be ``false``.
521 This command can only be executed using the api_key of a user with admin rights.
521 This command can only be executed using the api_key of a user with admin rights.
522
522
523 INPUT::
523 INPUT::
524
524
525 id : <id_for_response>
525 id : <id_for_response>
526 api_key : "<api_key>"
526 api_key : "<api_key>"
527 method : "remove_user_from_user_group"
527 method : "remove_user_from_user_group"
528 args : {
528 args : {
529 "usersgroupid" : "<user group id or name>",
529 "usersgroupid" : "<user group id or name>",
530 "userid" : "<user_id or username>"
530 "userid" : "<user_id or username>"
531 }
531 }
532
532
533 OUTPUT::
533 OUTPUT::
534
534
535 id : <id_given_in_input>
535 id : <id_given_in_input>
536 result : {
536 result : {
537 "success" : True|False, # depends on if member is in group
537 "success" : True|False, # depends on if member is in group
538 "msg" : "removed member <username> from user group <groupname> |
538 "msg" : "removed member <username> from user group <groupname> |
539 User wasn't in group"
539 User wasn't in group"
540 }
540 }
541 error : null
541 error : null
542
542
543 get_repo
543 get_repo
544 ^^^^^^^^
544 ^^^^^^^^
545
545
546 Get an existing repository by its name or repository_id. Members will contain
546 Get an existing repository by its name or repository_id. Members will contain
547 either users_group or users associated to that repository.
547 either users_group or users associated to that repository.
548 This command can only be executed using the api_key of a user with admin rights,
548 This command can only be executed using the api_key of a user with admin rights,
549 or that of a regular user with at least read access to the repository.
549 or that of a regular user with at least read access to the repository.
550
550
551 INPUT::
551 INPUT::
552
552
553 id : <id_for_response>
553 id : <id_for_response>
554 api_key : "<api_key>"
554 api_key : "<api_key>"
555 method : "get_repo"
555 method : "get_repo"
556 args : {
556 args : {
557 "repoid" : "<reponame or repo_id>",
557 "repoid" : "<reponame or repo_id>",
558 "with_revision_names" : "<bool> = Optional(False)",
558 "with_revision_names" : "<bool> = Optional(False)",
559 "with_pullrequests" : "<bool> = Optional(False)"
559 "with_pullrequests" : "<bool> = Optional(False)"
560 }
560 }
561
561
562 OUTPUT::
562 OUTPUT::
563
563
564 id : <id_given_in_input>
564 id : <id_given_in_input>
565 result : None if repository does not exist or
565 result : None if repository does not exist or
566 {
566 {
567 "repo_id" : "<repo_id>",
567 "repo_id" : "<repo_id>",
568 "repo_name" : "<reponame>",
568 "repo_name" : "<reponame>",
569 "repo_type" : "<repo_type>",
569 "repo_type" : "<repo_type>",
570 "clone_uri" : "<clone_uri>",
570 "clone_uri" : "<clone_uri>",
571 "enable_downloads" : "<bool>",
571 "enable_downloads" : "<bool>",
572 "enable_statistics": "<bool>",
572 "enable_statistics": "<bool>",
573 "private" : "<bool>",
573 "private" : "<bool>",
574 "created_on" : "<date_time_created>",
574 "created_on" : "<date_time_created>",
575 "description" : "<description>",
575 "description" : "<description>",
576 "landing_rev" : "<landing_rev>",
576 "landing_rev" : "<landing_rev>",
577 "last_changeset" : {
577 "last_changeset" : {
578 "author" : "<full_author>",
578 "author" : "<full_author>",
579 "date" : "<date_time_of_commit>",
579 "date" : "<date_time_of_commit>",
580 "message" : "<commit_message>",
580 "message" : "<commit_message>",
581 "raw_id" : "<raw_id>",
581 "raw_id" : "<raw_id>",
582 "revision": "<numeric_revision>",
582 "revision": "<numeric_revision>",
583 "short_id": "<short_id>"
583 "short_id": "<short_id>"
584 },
584 },
585 "owner" : "<repo_owner>",
585 "owner" : "<repo_owner>",
586 "fork_of" : "<name_of_fork_parent>",
586 "fork_of" : "<name_of_fork_parent>",
587 "members" : [
587 "members" : [
588 {
588 {
589 "type" : "user",
589 "type" : "user",
590 "user_id" : "<user_id>",
590 "user_id" : "<user_id>",
591 "api_key" : "<api_key>",
591 "api_key" : "<api_key>",
592 "username" : "<username>",
592 "username" : "<username>",
593 "firstname" : "<firstname>",
593 "firstname" : "<firstname>",
594 "lastname" : "<lastname>",
594 "lastname" : "<lastname>",
595 "email" : "<email>",
595 "email" : "<email>",
596 "emails" : "<list_of_all_additional_emails>",
596 "emails" : "<list_of_all_additional_emails>",
597 "active" : "<bool>",
597 "active" : "<bool>",
598 "admin" : "<bool>",
598 "admin" : "<bool>",
599 "ldap_dn" : "<ldap_dn>",
599 "ldap_dn" : "<ldap_dn>",
600 "last_login" : "<last_login>",
600 "last_login" : "<last_login>",
601 "permission" : "repository.(read|write|admin)"
601 "permission" : "repository.(read|write|admin)"
602 },
602 },
603 …
603 …
604 {
604 {
605 "type" : "users_group",
605 "type" : "users_group",
606 "id" : "<usersgroupid>",
606 "id" : "<usersgroupid>",
607 "name" : "<usersgroupname>",
607 "name" : "<usersgroupname>",
608 "active" : "<bool>",
608 "active" : "<bool>",
609 "permission" : "repository.(read|write|admin)"
609 "permission" : "repository.(read|write|admin)"
610 },
610 },
611 …
611 …
612 ],
612 ],
613 "followers" : [
613 "followers" : [
614 {
614 {
615 "user_id" : "<user_id>",
615 "user_id" : "<user_id>",
616 "username" : "<username>",
616 "username" : "<username>",
617 "api_key" : "<api_key>",
617 "api_key" : "<api_key>",
618 "firstname" : "<firstname>",
618 "firstname" : "<firstname>",
619 "lastname" : "<lastname>",
619 "lastname" : "<lastname>",
620 "email" : "<email>",
620 "email" : "<email>",
621 "emails" : "<list_of_all_additional_emails>",
621 "emails" : "<list_of_all_additional_emails>",
622 "ip_addresses": "<list_of_ip_addresses_for_user>",
622 "ip_addresses": "<list_of_ip_addresses_for_user>",
623 "active" : "<bool>",
623 "active" : "<bool>",
624 "admin" : "<bool>",
624 "admin" : "<bool>",
625 "ldap_dn" : "<ldap_dn>",
625 "ldap_dn" : "<ldap_dn>",
626 "last_login" : "<last_login>"
626 "last_login" : "<last_login>"
627 },
627 },
628 …
628 …
629 ],
629 ],
630 <if with_revision_names == True>
630 <if with_revision_names == True>
631 "tags" : {
631 "tags" : {
632 "<tagname>" : "<raw_id>",
632 "<tagname>" : "<raw_id>",
633 ...
633 ...
634 },
634 },
635 "branches" : {
635 "branches" : {
636 "<branchname>" : "<raw_id>",
636 "<branchname>" : "<raw_id>",
637 ...
637 ...
638 },
638 },
639 "bookmarks" : {
639 "bookmarks" : {
640 "<bookmarkname>" : "<raw_id>",
640 "<bookmarkname>" : "<raw_id>",
641 ...
641 ...
642 },
642 },
643 <if with_pullrequests == True>
643 <if with_pullrequests == True>
644 "pull_requests" : [
644 "pull_requests" : [
645 {
645 {
646 "status" : "<pull_request_status>",
646 "status" : "<pull_request_status>",
647 "pull_request_id" : <pull_request_id>,
647 "pull_request_id" : <pull_request_id>,
648 "description" : "<pull_request_description>",
648 "description" : "<pull_request_description>",
649 "title" : "<pull_request_title>",
649 "title" : "<pull_request_title>",
650 "url" : "<pull_request_url>",
650 "url" : "<pull_request_url>",
651 "reviewers" : [
651 "reviewers" : [
652 {
652 {
653 "username" : "<user_id>"
653 "username" : "<user_id>"
654 },
654 },
655 ...
655 ...
656 ],
656 ],
657 "org_repo_url" : "<repo_url>",
657 "org_repo_url" : "<repo_url>",
658 "org_ref_parts" : [
658 "org_ref_parts" : [
659 "<ref_type>",
659 "<ref_type>",
660 "<ref_name>",
660 "<ref_name>",
661 "<raw_id>"
661 "<raw_id>"
662 ],
662 ],
663 "other_ref_parts" : [
663 "other_ref_parts" : [
664 "<ref_type>",
664 "<ref_type>",
665 "<ref_name>",
665 "<ref_name>",
666 "<raw_id>"
666 "<raw_id>"
667 ],
667 ],
668 "comments" : [
668 "comments" : [
669 {
669 {
670 "username" : "<user_id>",
670 "username" : "<user_id>",
671 "text" : "<comment text>",
671 "text" : "<comment text>",
672 "comment_id" : "<comment_id>"
672 "comment_id" : "<comment_id>"
673 },
673 },
674 ...
674 ...
675 ],
675 ],
676 "owner" : "<username>",
676 "owner" : "<username>",
677 "statuses" : [
677 "statuses" : [
678 {
678 {
679 "status" : "<status_of_review>", # "under_review", "approved" or "rejected"
679 "status" : "<status_of_review>", # "under_review", "approved" or "rejected"
680 "reviewer" : "<user_id>",
680 "reviewer" : "<user_id>",
681 "modified_at" : "<date_time_of_review>" # iso 8601 date, server's timezone
681 "modified_at" : "<date_time_of_review>" # iso 8601 date, server's timezone
682 },
682 },
683 ...
683 ...
684 ],
684 ],
685 "revisions" : [
685 "revisions" : [
686 "<raw_id>",
686 "<raw_id>",
687 ...
687 ...
688 ]
688 ]
689 },
689 },
690 ...
690 ...
691 ]
691 ]
692 }
692 }
693 error : null
693 error : null
694
694
695 get_repos
695 get_repos
696 ^^^^^^^^^
696 ^^^^^^^^^
697
697
698 List all existing repositories.
698 List all existing repositories.
699 This command can only be executed using the api_key of a user with admin rights,
699 This command can only be executed using the api_key of a user with admin rights,
700 or that of a regular user with at least read access to the repository.
700 or that of a regular user with at least read access to the repository.
701
701
702 INPUT::
702 INPUT::
703
703
704 id : <id_for_response>
704 id : <id_for_response>
705 api_key : "<api_key>"
705 api_key : "<api_key>"
706 method : "get_repos"
706 method : "get_repos"
707 args : { }
707 args : { }
708
708
709 OUTPUT::
709 OUTPUT::
710
710
711 id : <id_given_in_input>
711 id : <id_given_in_input>
712 result : [
712 result : [
713 {
713 {
714 "repo_id" : "<repo_id>",
714 "repo_id" : "<repo_id>",
715 "repo_name" : "<reponame>",
715 "repo_name" : "<reponame>",
716 "repo_type" : "<repo_type>",
716 "repo_type" : "<repo_type>",
717 "clone_uri" : "<clone_uri>",
717 "clone_uri" : "<clone_uri>",
718 "private" : "<bool>",
718 "private" : "<bool>",
719 "created_on" : "<datetimecreated>",
719 "created_on" : "<datetimecreated>",
720 "description" : "<description>",
720 "description" : "<description>",
721 "landing_rev" : "<landing_rev>",
721 "landing_rev" : "<landing_rev>",
722 "owner" : "<repo_owner>",
722 "owner" : "<repo_owner>",
723 "fork_of" : "<name_of_fork_parent>",
723 "fork_of" : "<name_of_fork_parent>",
724 "enable_downloads" : "<bool>",
724 "enable_downloads" : "<bool>",
725 "enable_statistics": "<bool>"
725 "enable_statistics": "<bool>"
726 },
726 },
727 …
727 …
728 ]
728 ]
729 error : null
729 error : null
730
730
731 get_repo_nodes
731 get_repo_nodes
732 ^^^^^^^^^^^^^^
732 ^^^^^^^^^^^^^^
733
733
734 Return a list of files and directories for a given path at the given revision.
734 Return a list of files and directories for a given path at the given revision.
735 It is possible to specify ret_type to show only ``files`` or ``dirs``.
735 It is possible to specify ret_type to show only ``files`` or ``dirs``.
736 This command can only be executed using the api_key of a user with admin rights.
736 This command can only be executed using the api_key of a user with admin rights.
737
737
738 INPUT::
738 INPUT::
739
739
740 id : <id_for_response>
740 id : <id_for_response>
741 api_key : "<api_key>"
741 api_key : "<api_key>"
742 method : "get_repo_nodes"
742 method : "get_repo_nodes"
743 args : {
743 args : {
744 "repoid" : "<reponame or repo_id>",
744 "repoid" : "<reponame or repo_id>",
745 "revision" : "<revision>",
745 "revision" : "<revision>",
746 "root_path" : "<root_path>",
746 "root_path" : "<root_path>",
747 "ret_type" : "<ret_type> = Optional('all')"
747 "ret_type" : "<ret_type> = Optional('all')"
748 }
748 }
749
749
750 OUTPUT::
750 OUTPUT::
751
751
752 id : <id_given_in_input>
752 id : <id_given_in_input>
753 result : [
753 result : [
754 {
754 {
755 "name" : "<name>",
755 "name" : "<name>",
756 "type" : "<type>"
756 "type" : "<type>"
757 },
757 },
758 …
758 …
759 ]
759 ]
760 error : null
760 error : null
761
761
762 create_repo
762 create_repo
763 ^^^^^^^^^^^
763 ^^^^^^^^^^^
764
764
765 Create a repository. If the repository name contains "/", the repository will be
765 Create a repository. If the repository name contains "/", the repository will be
766 created in the repository group indicated by that path. Any such repository
766 created in the repository group indicated by that path. Any such repository
767 groups need to exist before calling this method, or the call will fail.
767 groups need to exist before calling this method, or the call will fail.
768 For example "foo/bar/baz" will create a repository "baz" inside the repository
768 For example "foo/bar/baz" will create a repository "baz" inside the repository
769 group "bar" which itself is in a repository group "foo", but both "foo" and
769 group "bar" which itself is in a repository group "foo", but both "foo" and
770 "bar" already need to exist before calling this method.
770 "bar" already need to exist before calling this method.
771 This command can only be executed using the api_key of a user with admin rights,
771 This command can only be executed using the api_key of a user with admin rights,
772 or that of a regular user with create repository permission.
772 or that of a regular user with create repository permission.
773 Regular users cannot specify owner parameter.
773 Regular users cannot specify owner parameter.
774
774
775 INPUT::
775 INPUT::
776
776
777 id : <id_for_response>
777 id : <id_for_response>
778 api_key : "<api_key>"
778 api_key : "<api_key>"
779 method : "create_repo"
779 method : "create_repo"
780 args : {
780 args : {
781 "repo_name" : "<reponame>",
781 "repo_name" : "<reponame>",
782 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
782 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
783 "repo_type" : "<repo_type> = Optional('hg')",
783 "repo_type" : "<repo_type> = Optional('hg')",
784 "description" : "<description> = Optional('')",
784 "description" : "<description> = Optional('')",
785 "private" : "<bool> = Optional(False)",
785 "private" : "<bool> = Optional(False)",
786 "clone_uri" : "<clone_uri> = Optional(None)",
786 "clone_uri" : "<clone_uri> = Optional(None)",
787 "landing_rev" : "<landing_rev> = Optional('tip')",
787 "landing_rev" : "<landing_rev> = Optional('tip')",
788 "enable_downloads" : "<bool> = Optional(False)",
788 "enable_downloads" : "<bool> = Optional(False)",
789 "enable_statistics": "<bool> = Optional(False)"
789 "enable_statistics": "<bool> = Optional(False)"
790 }
790 }
791
791
792 OUTPUT::
792 OUTPUT::
793
793
794 id : <id_given_in_input>
794 id : <id_given_in_input>
795 result : {
795 result : {
796 "msg" : "Created new repository `<reponame>`",
796 "msg" : "Created new repository `<reponame>`",
797 "repo" : {
797 "repo" : {
798 "repo_id" : "<repo_id>",
798 "repo_id" : "<repo_id>",
799 "repo_name" : "<reponame>",
799 "repo_name" : "<reponame>",
800 "repo_type" : "<repo_type>",
800 "repo_type" : "<repo_type>",
801 "clone_uri" : "<clone_uri>",
801 "clone_uri" : "<clone_uri>",
802 "private" : "<bool>",
802 "private" : "<bool>",
803 "created_on" : "<datetimecreated>",
803 "created_on" : "<datetimecreated>",
804 "description" : "<description>",
804 "description" : "<description>",
805 "landing_rev" : "<landing_rev>",
805 "landing_rev" : "<landing_rev>",
806 "owner" : "<username or user_id>",
806 "owner" : "<username or user_id>",
807 "fork_of" : "<name_of_fork_parent>",
807 "fork_of" : "<name_of_fork_parent>",
808 "enable_downloads" : "<bool>",
808 "enable_downloads" : "<bool>",
809 "enable_statistics": "<bool>"
809 "enable_statistics": "<bool>"
810 }
810 }
811 }
811 }
812 error : null
812 error : null
813
813
814 update_repo
814 update_repo
815 ^^^^^^^^^^^
815 ^^^^^^^^^^^
816
816
817 Update a repository.
817 Update a repository.
818 This command can only be executed using the api_key of a user with admin rights,
818 This command can only be executed using the api_key of a user with admin rights,
819 or that of a regular user with create repository permission.
819 or that of a regular user with create repository permission.
820 Regular users cannot specify owner parameter.
820 Regular users cannot specify owner parameter.
821
821
822 INPUT::
822 INPUT::
823
823
824 id : <id_for_response>
824 id : <id_for_response>
825 api_key : "<api_key>"
825 api_key : "<api_key>"
826 method : "update_repo"
826 method : "update_repo"
827 args : {
827 args : {
828 "repoid" : "<reponame or repo_id>",
828 "repoid" : "<reponame or repo_id>",
829 "name" : "<reponame> = Optional('')",
829 "name" : "<reponame> = Optional('')",
830 "group" : "<group_id> = Optional(None)",
830 "group" : "<group_id> = Optional(None)",
831 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
831 "owner" : "<owner_name_or_id = Optional(=apiuser)>",
832 "description" : "<description> = Optional('')",
832 "description" : "<description> = Optional('')",
833 "private" : "<bool> = Optional(False)",
833 "private" : "<bool> = Optional(False)",
834 "clone_uri" : "<clone_uri> = Optional(None)",
834 "clone_uri" : "<clone_uri> = Optional(None)",
835 "landing_rev" : "<landing_rev> = Optional('tip')",
835 "landing_rev" : "<landing_rev> = Optional('tip')",
836 "enable_downloads" : "<bool> = Optional(False)",
836 "enable_downloads" : "<bool> = Optional(False)",
837 "enable_statistics": "<bool> = Optional(False)"
837 "enable_statistics": "<bool> = Optional(False)"
838 }
838 }
839
839
840 OUTPUT::
840 OUTPUT::
841
841
842 id : <id_given_in_input>
842 id : <id_given_in_input>
843 result : {
843 result : {
844 "msg" : "updated repo ID:repo_id `<reponame>`",
844 "msg" : "updated repo ID:repo_id `<reponame>`",
845 "repository" : {
845 "repository" : {
846 "repo_id" : "<repo_id>",
846 "repo_id" : "<repo_id>",
847 "repo_name" : "<reponame>",
847 "repo_name" : "<reponame>",
848 "repo_type" : "<repo_type>",
848 "repo_type" : "<repo_type>",
849 "clone_uri" : "<clone_uri>",
849 "clone_uri" : "<clone_uri>",
850 "private" : "<bool>",
850 "private" : "<bool>",
851 "created_on" : "<datetimecreated>",
851 "created_on" : "<datetimecreated>",
852 "description" : "<description>",
852 "description" : "<description>",
853 "landing_rev" : "<landing_rev>",
853 "landing_rev" : "<landing_rev>",
854 "owner" : "<username or user_id>",
854 "owner" : "<username or user_id>",
855 "fork_of" : "<name_of_fork_parent>",
855 "fork_of" : "<name_of_fork_parent>",
856 "enable_downloads" : "<bool>",
856 "enable_downloads" : "<bool>",
857 "enable_statistics": "<bool>",
857 "enable_statistics": "<bool>",
858 "last_changeset" : {
858 "last_changeset" : {
859 "author" : "<full_author>",
859 "author" : "<full_author>",
860 "date" : "<date_time_of_commit>",
860 "date" : "<date_time_of_commit>",
861 "message" : "<commit_message>",
861 "message" : "<commit_message>",
862 "raw_id" : "<raw_id>",
862 "raw_id" : "<raw_id>",
863 "revision": "<numeric_revision>",
863 "revision": "<numeric_revision>",
864 "short_id": "<short_id>"
864 "short_id": "<short_id>"
865 }
865 }
866 }
866 }
867 }
867 }
868 error : null
868 error : null
869
869
870 fork_repo
870 fork_repo
871 ^^^^^^^^^
871 ^^^^^^^^^
872
872
873 Create a fork of the given repo. If using Celery, this will
873 Create a fork of the given repo. If using Celery, this will
874 return success message immediately and a fork will be created
874 return success message immediately and a fork will be created
875 asynchronously.
875 asynchronously.
876 This command can only be executed using the api_key of a user with admin
876 This command can only be executed using the api_key of a user with admin
877 rights, or with the global fork permission, by a regular user with create
877 rights, or with the global fork permission, by a regular user with create
878 repository permission and at least read access to the repository.
878 repository permission and at least read access to the repository.
879 Regular users cannot specify owner parameter.
879 Regular users cannot specify owner parameter.
880
880
881 INPUT::
881 INPUT::
882
882
883 id : <id_for_response>
883 id : <id_for_response>
884 api_key : "<api_key>"
884 api_key : "<api_key>"
885 method : "fork_repo"
885 method : "fork_repo"
886 args : {
886 args : {
887 "repoid" : "<reponame or repo_id>",
887 "repoid" : "<reponame or repo_id>",
888 "fork_name" : "<forkname>",
888 "fork_name" : "<forkname>",
889 "owner" : "<username or user_id = Optional(=apiuser)>",
889 "owner" : "<username or user_id = Optional(=apiuser)>",
890 "description" : "<description>",
890 "description" : "<description>",
891 "copy_permissions": "<bool>",
891 "copy_permissions": "<bool>",
892 "private" : "<bool>",
892 "private" : "<bool>",
893 "landing_rev" : "<landing_rev>"
893 "landing_rev" : "<landing_rev>"
894 }
894 }
895
895
896 OUTPUT::
896 OUTPUT::
897
897
898 id : <id_given_in_input>
898 id : <id_given_in_input>
899 result : {
899 result : {
900 "msg" : "Created fork of `<reponame>` as `<forkname>`",
900 "msg" : "Created fork of `<reponame>` as `<forkname>`",
901 "success" : true
901 "success" : true
902 }
902 }
903 error : null
903 error : null
904
904
905 delete_repo
905 delete_repo
906 ^^^^^^^^^^^
906 ^^^^^^^^^^^
907
907
908 Delete a repository.
908 Delete a repository.
909 This command can only be executed using the api_key of a user with admin rights,
909 This command can only be executed using the api_key of a user with admin rights,
910 or that of a regular user with admin access to the repository.
910 or that of a regular user with admin access to the repository.
911 When ``forks`` param is set it is possible to detach or delete forks of the deleted repository.
911 When ``forks`` param is set it is possible to detach or delete forks of the deleted repository.
912
912
913 INPUT::
913 INPUT::
914
914
915 id : <id_for_response>
915 id : <id_for_response>
916 api_key : "<api_key>"
916 api_key : "<api_key>"
917 method : "delete_repo"
917 method : "delete_repo"
918 args : {
918 args : {
919 "repoid" : "<reponame or repo_id>",
919 "repoid" : "<reponame or repo_id>",
920 "forks" : "`delete` or `detach` = Optional(None)"
920 "forks" : "`delete` or `detach` = Optional(None)"
921 }
921 }
922
922
923 OUTPUT::
923 OUTPUT::
924
924
925 id : <id_given_in_input>
925 id : <id_given_in_input>
926 result : {
926 result : {
927 "msg" : "Deleted repository `<reponame>`",
927 "msg" : "Deleted repository `<reponame>`",
928 "success" : true
928 "success" : true
929 }
929 }
930 error : null
930 error : null
931
931
932 grant_user_permission
932 grant_user_permission
933 ^^^^^^^^^^^^^^^^^^^^^
933 ^^^^^^^^^^^^^^^^^^^^^
934
934
935 Grant permission for a user on the given repository, or update the existing one if found.
935 Grant permission for a user on the given repository, or update the existing one if found.
936 This command can only be executed using the api_key of a user with admin rights.
936 This command can only be executed using the api_key of a user with admin rights.
937
937
938 INPUT::
938 INPUT::
939
939
940 id : <id_for_response>
940 id : <id_for_response>
941 api_key : "<api_key>"
941 api_key : "<api_key>"
942 method : "grant_user_permission"
942 method : "grant_user_permission"
943 args : {
943 args : {
944 "repoid" : "<reponame or repo_id>",
944 "repoid" : "<reponame or repo_id>",
945 "userid" : "<username or user_id>",
945 "userid" : "<username or user_id>",
946 "perm" : "(repository.(none|read|write|admin))"
946 "perm" : "(repository.(none|read|write|admin))"
947 }
947 }
948
948
949 OUTPUT::
949 OUTPUT::
950
950
951 id : <id_given_in_input>
951 id : <id_given_in_input>
952 result : {
952 result : {
953 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
953 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
954 "success" : true
954 "success" : true
955 }
955 }
956 error : null
956 error : null
957
957
958 revoke_user_permission
958 revoke_user_permission
959 ^^^^^^^^^^^^^^^^^^^^^^
959 ^^^^^^^^^^^^^^^^^^^^^^
960
960
961 Revoke permission for a user on the given repository.
961 Revoke permission for a user on the given repository.
962 This command can only be executed using the api_key of a user with admin rights.
962 This command can only be executed using the api_key of a user with admin rights.
963
963
964 INPUT::
964 INPUT::
965
965
966 id : <id_for_response>
966 id : <id_for_response>
967 api_key : "<api_key>"
967 api_key : "<api_key>"
968 method : "revoke_user_permission"
968 method : "revoke_user_permission"
969 args : {
969 args : {
970 "repoid" : "<reponame or repo_id>",
970 "repoid" : "<reponame or repo_id>",
971 "userid" : "<username or user_id>"
971 "userid" : "<username or user_id>"
972 }
972 }
973
973
974 OUTPUT::
974 OUTPUT::
975
975
976 id : <id_given_in_input>
976 id : <id_given_in_input>
977 result : {
977 result : {
978 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
978 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
979 "success" : true
979 "success" : true
980 }
980 }
981 error : null
981 error : null
982
982
983 grant_user_group_permission
983 grant_user_group_permission
984 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
984 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
985
985
986 Grant permission for a user group on the given repository, or update the
986 Grant permission for a user group on the given repository, or update the
987 existing one if found.
987 existing one if found.
988 This command can only be executed using the api_key of a user with admin rights.
988 This command can only be executed using the api_key of a user with admin rights.
989
989
990 INPUT::
990 INPUT::
991
991
992 id : <id_for_response>
992 id : <id_for_response>
993 api_key : "<api_key>"
993 api_key : "<api_key>"
994 method : "grant_user_group_permission"
994 method : "grant_user_group_permission"
995 args : {
995 args : {
996 "repoid" : "<reponame or repo_id>",
996 "repoid" : "<reponame or repo_id>",
997 "usersgroupid" : "<user group id or name>",
997 "usersgroupid" : "<user group id or name>",
998 "perm" : "(repository.(none|read|write|admin))"
998 "perm" : "(repository.(none|read|write|admin))"
999 }
999 }
1000
1000
1001 OUTPUT::
1001 OUTPUT::
1002
1002
1003 id : <id_given_in_input>
1003 id : <id_given_in_input>
1004 result : {
1004 result : {
1005 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
1005 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
1006 "success" : true
1006 "success" : true
1007 }
1007 }
1008 error : null
1008 error : null
1009
1009
1010 revoke_user_group_permission
1010 revoke_user_group_permission
1011 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1011 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1012
1012
1013 Revoke permission for a user group on the given repository.
1013 Revoke permission for a user group on the given repository.
1014 This command can only be executed using the api_key of a user with admin rights.
1014 This command can only be executed using the api_key of a user with admin rights.
1015
1015
1016 INPUT::
1016 INPUT::
1017
1017
1018 id : <id_for_response>
1018 id : <id_for_response>
1019 api_key : "<api_key>"
1019 api_key : "<api_key>"
1020 method : "revoke_user_group_permission"
1020 method : "revoke_user_group_permission"
1021 args : {
1021 args : {
1022 "repoid" : "<reponame or repo_id>",
1022 "repoid" : "<reponame or repo_id>",
1023 "usersgroupid" : "<user group id or name>"
1023 "usersgroupid" : "<user group id or name>"
1024 }
1024 }
1025
1025
1026 OUTPUT::
1026 OUTPUT::
1027
1027
1028 id : <id_given_in_input>
1028 id : <id_given_in_input>
1029 result : {
1029 result : {
1030 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
1030 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
1031 "success" : true
1031 "success" : true
1032 }
1032 }
1033 error : null
1033 error : null
1034
1034
1035 get_changesets
1035 get_changesets
1036 ^^^^^^^^^^^^^^
1036 ^^^^^^^^^^^^^^
1037
1037
1038 Get changesets of a given repository. This command can only be executed using the api_key
1038 Get changesets of a given repository. This command can only be executed using the api_key
1039 of a user with read permissions to the repository.
1039 of a user with read permissions to the repository.
1040
1040
1041 INPUT::
1041 INPUT::
1042
1042
1043 id : <id_for_response>
1043 id : <id_for_response>
1044 api_key : "<api_key>"
1044 api_key : "<api_key>"
1045 method : "get_changesets"
1045 method : "get_changesets"
1046 args : {
1046 args : {
1047 "repoid" : "<reponame or repo_id>",
1047 "repoid" : "<reponame or repo_id>",
1048 "start" : "<revision number> = Optional(None)",
1048 "start" : "<revision number> = Optional(None)",
1049 "end" : "<revision number> = Optional(None)",
1049 "end" : "<revision number> = Optional(None)",
1050 "start_date" : "<date> = Optional(None)", # in "%Y-%m-%dT%H:%M:%S" format
1050 "start_date" : "<date> = Optional(None)", # in "%Y-%m-%dT%H:%M:%S" format
1051 "end_date" : "<date> = Optional(None)", # in "%Y-%m-%dT%H:%M:%S" format
1051 "end_date" : "<date> = Optional(None)", # in "%Y-%m-%dT%H:%M:%S" format
1052 "branch_name" : "<branch name filter> = Optional(None)",
1052 "branch_name" : "<branch name filter> = Optional(None)",
1053 "reverse" : "<bool> = Optional(False)",
1053 "reverse" : "<bool> = Optional(False)",
1054 "with_file_list" : "<bool> = Optional(False)"
1054 "with_file_list" : "<bool> = Optional(False)"
1055 }
1055 }
1056
1056
1057 OUTPUT::
1057 OUTPUT::
1058
1058
1059 id : <id_given_in_input>
1059 id : <id_given_in_input>
1060 result : [
1060 result : [
1061 {
1061 {
1062 "raw_id" : "<raw_id>",
1062 "raw_id" : "<raw_id>",
1063 "short_id" : "<short_id>",
1063 "short_id" : "<short_id>",
1064 "author" : "<full_author>",
1064 "author" : "<full_author>",
1065 "date" : "<date_time_of_commit>",
1065 "date" : "<date_time_of_commit>",
1066 "message" : "<commit_message>",
1066 "message" : "<commit_message>",
1067 "revision" : "<numeric_revision>",
1067 "revision" : "<numeric_revision>",
1068 <if with_file_list == True>
1068 <if with_file_list == True>
1069 "added" : [<list of added files>],
1069 "added" : [<list of added files>],
1070 "changed" : [<list of changed files>],
1070 "changed" : [<list of changed files>],
1071 "removed" : [<list of removed files>]
1071 "removed" : [<list of removed files>]
1072 },
1072 },
1073 ...
1073 ...
1074 ]
1074 ]
1075 error : null
1075 error : null
1076
1076
1077 get_changeset
1077 get_changeset
1078 ^^^^^^^^^^^^^
1078 ^^^^^^^^^^^^^
1079
1079
1080 Get information and review status for a given changeset. This command can only
1080 Get information and review status for a given changeset. This command can only
1081 be executed using the api_key of a user with read permissions to the
1081 be executed using the api_key of a user with read permissions to the
1082 repository.
1082 repository.
1083
1083
1084 INPUT::
1084 INPUT::
1085
1085
1086 id : <id_for_response>
1086 id : <id_for_response>
1087 api_key : "<api_key>"
1087 api_key : "<api_key>"
1088 method : "get_changeset"
1088 method : "get_changeset"
1089 args : {
1089 args : {
1090 "repoid" : "<reponame or repo_id>",
1090 "repoid" : "<reponame or repo_id>",
1091 "raw_id" : "<raw_id>",
1091 "raw_id" : "<raw_id>",
1092 "with_reviews" : "<bool> = Optional(False)"
1092 "with_reviews" : "<bool> = Optional(False)"
1093 }
1093 }
1094
1094
1095 OUTPUT::
1095 OUTPUT::
1096
1096
1097 id : <id_given_in_input>
1097 id : <id_given_in_input>
1098 result : {
1098 result : {
1099 "author" : "<full_author>",
1099 "author" : "<full_author>",
1100 "date" : "<date_time_of_commit>",
1100 "date" : "<date_time_of_commit>",
1101 "message" : "<commit_message>",
1101 "message" : "<commit_message>",
1102 "raw_id" : "<raw_id>",
1102 "raw_id" : "<raw_id>",
1103 "revision": "<numeric_revision>",
1103 "revision": "<numeric_revision>",
1104 "short_id": "<short_id>",
1104 "short_id": "<short_id>",
1105 "reviews" : [{
1105 "reviews" : [{
1106 "reviewer" : "<username>",
1106 "reviewer" : "<username>",
1107 "modified_at" : "<date_time_of_review>", # iso 8601 date, server's timezone
1107 "modified_at" : "<date_time_of_review>", # iso 8601 date, server's timezone
1108 "status" : "<status_of_review>", # "under_review", "approved" or "rejected"
1108 "status" : "<status_of_review>", # "under_review", "approved" or "rejected"
1109 },
1109 },
1110 ...
1110 ...
1111 ]
1111 ]
1112 }
1112 }
1113 error : null
1113 error : null
1114
1114
1115 Example output::
1115 Example output::
1116
1116
1117 {
1117 {
1118 "id" : 1,
1118 "id" : 1,
1119 "error" : null,
1119 "error" : null,
1120 "result" : {
1120 "result" : {
1121 "author" : {
1121 "author" : {
1122 "email" : "user@example.com",
1122 "email" : "user@example.com",
1123 "name" : "Kallithea Admin"
1123 "name" : "Kallithea Admin"
1124 },
1124 },
1125 "changed" : [],
1125 "changed" : [],
1126 "short_id" : "e1022d3d28df",
1126 "short_id" : "e1022d3d28df",
1127 "date" : "2017-03-28T09:09:03",
1127 "date" : "2017-03-28T09:09:03",
1128 "added" : [
1128 "added" : [
1129 "README.rst"
1129 "README.rst"
1130 ],
1130 ],
1131 "removed" : [],
1131 "removed" : [],
1132 "revision" : 0,
1132 "revision" : 0,
1133 "raw_id" : "e1022d3d28dfba02f626cde65dbe08f4ceb0e4e7",
1133 "raw_id" : "e1022d3d28dfba02f626cde65dbe08f4ceb0e4e7",
1134 "message" : "Added file via Kallithea",
1134 "message" : "Added file via Kallithea",
1135 "id" : "e1022d3d28dfba02f626cde65dbe08f4ceb0e4e7",
1135 "id" : "e1022d3d28dfba02f626cde65dbe08f4ceb0e4e7",
1136 "reviews" : [
1136 "reviews" : [
1137 {
1137 {
1138 "status" : "under_review",
1138 "status" : "under_review",
1139 "modified_at" : "2017-03-28T09:17:08.618",
1139 "modified_at" : "2017-03-28T09:17:08.618",
1140 "reviewer" : "user"
1140 "reviewer" : "user"
1141 }
1141 }
1142 ]
1142 ]
1143 }
1143 }
1144 }
1144 }
1145
1145
1146 get_pullrequest
1146 get_pullrequest
1147 ^^^^^^^^^^^^^^^
1147 ^^^^^^^^^^^^^^^
1148
1148
1149 Get information and review status for a given pull request. This command can only be executed
1149 Get information and review status for a given pull request. This command can only be executed
1150 using the api_key of a user with read permissions to the original repository.
1150 using the api_key of a user with read permissions to the original repository.
1151
1151
1152 INPUT::
1152 INPUT::
1153
1153
1154 id : <id_for_response>
1154 id : <id_for_response>
1155 api_key : "<api_key>"
1155 api_key : "<api_key>"
1156 method : "get_pullrequest"
1156 method : "get_pullrequest"
1157 args : {
1157 args : {
1158 "pullrequest_id" : "<pullrequest_id>"
1158 "pullrequest_id" : "<pullrequest_id>"
1159 }
1159 }
1160
1160
1161 OUTPUT::
1161 OUTPUT::
1162
1162
1163 id : <id_given_in_input>
1163 id : <id_given_in_input>
1164 result : {
1164 result : {
1165 "status" : "<pull_request_status>",
1165 "status" : "<pull_request_status>",
1166 "pull_request_id" : <pull_request_id>,
1166 "pull_request_id" : <pull_request_id>,
1167 "description" : "<pull_request_description>",
1167 "description" : "<pull_request_description>",
1168 "title" : "<pull_request_title>",
1168 "title" : "<pull_request_title>",
1169 "url" : "<pull_request_url>",
1169 "url" : "<pull_request_url>",
1170 "reviewers" : [
1170 "reviewers" : [
1171 {
1171 {
1172 "username" : "<user_name>"
1172 "username" : "<user_name>"
1173 },
1173 },
1174 ...
1174 ...
1175 ],
1175 ],
1176 "org_repo_url" : "<repo_url>",
1176 "org_repo_url" : "<repo_url>",
1177 "org_ref_parts" : [
1177 "org_ref_parts" : [
1178 "<ref_type>",
1178 "<ref_type>",
1179 "<ref_name>",
1179 "<ref_name>",
1180 "<raw_id>"
1180 "<raw_id>"
1181 ],
1181 ],
1182 "other_ref_parts" : [
1182 "other_ref_parts" : [
1183 "<ref_type>",
1183 "<ref_type>",
1184 "<ref_name>",
1184 "<ref_name>",
1185 "<raw_id>"
1185 "<raw_id>"
1186 ],
1186 ],
1187 "comments" : [
1187 "comments" : [
1188 {
1188 {
1189 "username" : "<user_name>",
1189 "username" : "<user_name>",
1190 "text" : "<comment text>",
1190 "text" : "<comment text>",
1191 "comment_id" : "<comment_id>"
1191 "comment_id" : "<comment_id>"
1192 },
1192 },
1193 ...
1193 ...
1194 ],
1194 ],
1195 "owner" : "<username>",
1195 "owner" : "<username>",
1196 "statuses" : [
1196 "statuses" : [
1197 {
1197 {
1198 "status" : "<status_of_review>", # "under_review", "approved" or "rejected"
1198 "status" : "<status_of_review>", # "under_review", "approved" or "rejected"
1199 "reviewer" : "<user_name>",
1199 "reviewer" : "<user_name>",
1200 "modified_at" : "<date_time_of_review>" # iso 8601 date, server's timezone
1200 "modified_at" : "<date_time_of_review>" # iso 8601 date, server's timezone
1201 },
1201 },
1202 ...
1202 ...
1203 ],
1203 ],
1204 "revisions" : [
1204 "revisions" : [
1205 "<raw_id>",
1205 "<raw_id>",
1206 ...
1206 ...
1207 ]
1207 ]
1208 },
1208 },
1209 error : null
1209 error : null
1210
1210
1211 comment_pullrequest
1211 comment_pullrequest
1212 ^^^^^^^^^^^^^^^^^^^
1212 ^^^^^^^^^^^^^^^^^^^
1213
1213
1214 Add comment, change status or close a given pull request. This command can only be executed
1214 Add comment, change status or close a given pull request. This command can only be executed
1215 using the api_key of a user with read permissions to the original repository.
1215 using the api_key of a user with read permissions to the original repository.
1216
1216
1217 INPUT::
1217 INPUT::
1218
1218
1219 id : <id_for_response>
1219 id : <id_for_response>
1220 api_key : "<api_key>"
1220 api_key : "<api_key>"
1221 method : "comment_pullrequest"
1221 method : "comment_pullrequest"
1222 args : {
1222 args : {
1223 "pull_request_id" : "<pull_request_id>",
1223 "pull_request_id" : "<pull_request_id>",
1224 "comment_msg" : Optional(''),
1224 "comment_msg" : Optional(''),
1225 "status" : Optional(None), # "under_review", "approved" or "rejected"
1225 "status" : Optional(None), # "under_review", "approved" or "rejected"
1226 "close_pr" : Optional(False)"
1226 "close_pr" : Optional(False)"
1227 }
1227 }
1228
1228
1229 OUTPUT::
1229 OUTPUT::
1230
1230
1231 id : <id_given_in_input>
1231 id : <id_given_in_input>
1232 result : True
1232 result : True
1233 error : null
1233 error : null
1234
1234
1235
1235
1236 API access for web views
1236 API access for web views
1237 ------------------------
1237 ------------------------
1238
1238
1239 Kallithea HTTP entry points can also be accessed without login using bearer
1239 Kallithea HTTP entry points can also be accessed without login using bearer
1240 authentication by including this header with the request::
1240 authentication by including this header with the request::
1241
1241
1242 Authentication: Bearer <api_key>
1242 Authentication: Bearer <api_key>
1243
1243
1244 Alternatively, the API key can be passed in the URL query string using
1244 Alternatively, the API key can be passed in the URL query string using
1245 ``?api_key=<api_key>``, though this is not recommended due to the increased
1245 ``?api_key=<api_key>``, though this is not recommended due to the increased
1246 risk of API key leaks, and support will likely be removed in the future.
1246 risk of API key leaks, and support will likely be removed in the future.
1247
1247
1248 Exposing raw diffs is a good way to integrate with
1248 Exposing raw diffs is a good way to integrate with
1249 third-party services like code review, or build farms that can download archives.
1249 third-party services like code review, or build farms that can download archives.
General Comments 0
You need to be logged in to leave comments. Login now