Show More
@@ -1,1251 +1,1251 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":{"repo":"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_clien>", |
|
185 | "ip_addr_server": <ip_from_clien>", | |
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 |
|
194 | |||
195 | error : null |
|
195 | error : null | |
196 |
|
196 | |||
197 | get_user |
|
197 | get_user | |
198 | ^^^^^^^^ |
|
198 | ^^^^^^^^ | |
199 |
|
199 | |||
200 | Get a user by username or userid. The result is empty if user can't be found. |
|
200 | Get a user by username or userid. The result is empty if user can't be found. | |
201 | If userid param is skipped, it is set to id of user who is calling this method. |
|
201 | If userid param is skipped, it is set to id of user who is calling this method. | |
202 | Any userid can be specified when the command is executed using the api_key of a user with admin rights. |
|
202 | Any userid can be specified when the command is executed using the api_key of a user with admin rights. | |
203 | Regular users can only specify their own userid. |
|
203 | Regular users can only specify their own userid. | |
204 |
|
204 | |||
205 | INPUT:: |
|
205 | INPUT:: | |
206 |
|
206 | |||
207 | id : <id_for_response> |
|
207 | id : <id_for_response> | |
208 | api_key : "<api_key>" |
|
208 | api_key : "<api_key>" | |
209 | method : "get_user" |
|
209 | method : "get_user" | |
210 | args : { |
|
210 | args : { | |
211 | "userid" : "<username or user_id Optional(=apiuser)>" |
|
211 | "userid" : "<username or user_id Optional(=apiuser)>" | |
212 | } |
|
212 | } | |
213 |
|
213 | |||
214 | OUTPUT:: |
|
214 | OUTPUT:: | |
215 |
|
215 | |||
216 | id : <id_given_in_input> |
|
216 | id : <id_given_in_input> | |
217 | result: None if user does not exist or |
|
217 | result: None if user does not exist or | |
218 | { |
|
218 | { | |
219 | "user_id" : "<user_id>", |
|
219 | "user_id" : "<user_id>", | |
220 | "api_key" : "<api_key>", |
|
220 | "api_key" : "<api_key>", | |
221 | "username" : "<username>", |
|
221 | "username" : "<username>", | |
222 | "firstname": "<firstname>", |
|
222 | "firstname": "<firstname>", | |
223 | "lastname" : "<lastname>", |
|
223 | "lastname" : "<lastname>", | |
224 | "email" : "<email>", |
|
224 | "email" : "<email>", | |
225 | "emails": "<list_of_all_additional_emails>", |
|
225 | "emails": "<list_of_all_additional_emails>", | |
226 | "ip_addresses": "<list_of_ip_addresses_for_user>", |
|
226 | "ip_addresses": "<list_of_ip_addresses_for_user>", | |
227 | "active" : "<bool>", |
|
227 | "active" : "<bool>", | |
228 | "admin" :Β "<bool>", |
|
228 | "admin" :Β "<bool>", | |
229 | "ldap_dn" : "<ldap_dn>", |
|
229 | "ldap_dn" : "<ldap_dn>", | |
230 | "last_login": "<last_login>", |
|
230 | "last_login": "<last_login>", | |
231 | "permissions": { |
|
231 | "permissions": { | |
232 | "global": ["hg.create.repository", |
|
232 | "global": ["hg.create.repository", | |
233 | "repository.read", |
|
233 | "repository.read", | |
234 | "hg.register.manual_activate"], |
|
234 | "hg.register.manual_activate"], | |
235 | "repositories": {"repo1": "repository.none"}, |
|
235 | "repositories": {"repo1": "repository.none"}, | |
236 | "repositories_groups": {"Group1": "group.read"} |
|
236 | "repositories_groups": {"Group1": "group.read"} | |
237 | }, |
|
237 | }, | |
238 | } |
|
238 | } | |
239 | error: null |
|
239 | error: null | |
240 |
|
240 | |||
241 | get_users |
|
241 | get_users | |
242 | ^^^^^^^^^ |
|
242 | ^^^^^^^^^ | |
243 |
|
243 | |||
244 | List all existing users. |
|
244 | List all existing users. | |
245 | This command can only be executed using the api_key of a user with admin rights. |
|
245 | This command can only be executed using the api_key of a user with admin rights. | |
246 |
|
246 | |||
247 | INPUT:: |
|
247 | INPUT:: | |
248 |
|
248 | |||
249 | id : <id_for_response> |
|
249 | id : <id_for_response> | |
250 | api_key : "<api_key>" |
|
250 | api_key : "<api_key>" | |
251 | method : "get_users" |
|
251 | method : "get_users" | |
252 | args : { } |
|
252 | args : { } | |
253 |
|
253 | |||
254 | OUTPUT:: |
|
254 | OUTPUT:: | |
255 |
|
255 | |||
256 | id : <id_given_in_input> |
|
256 | id : <id_given_in_input> | |
257 | result: [ |
|
257 | result: [ | |
258 | { |
|
258 | { | |
259 | "user_id" : "<user_id>", |
|
259 | "user_id" : "<user_id>", | |
260 | "api_key" : "<api_key>", |
|
260 | "api_key" : "<api_key>", | |
261 | "username" : "<username>", |
|
261 | "username" : "<username>", | |
262 | "firstname": "<firstname>", |
|
262 | "firstname": "<firstname>", | |
263 | "lastname" : "<lastname>", |
|
263 | "lastname" : "<lastname>", | |
264 | "email" : "<email>", |
|
264 | "email" : "<email>", | |
265 | "emails": "<list_of_all_additional_emails>", |
|
265 | "emails": "<list_of_all_additional_emails>", | |
266 | "ip_addresses": "<list_of_ip_addresses_for_user>", |
|
266 | "ip_addresses": "<list_of_ip_addresses_for_user>", | |
267 | "active" : "<bool>", |
|
267 | "active" : "<bool>", | |
268 | "admin" :Β "<bool>", |
|
268 | "admin" :Β "<bool>", | |
269 | "ldap_dn" : "<ldap_dn>", |
|
269 | "ldap_dn" : "<ldap_dn>", | |
270 | "last_login": "<last_login>", |
|
270 | "last_login": "<last_login>", | |
271 | }, |
|
271 | }, | |
272 | β¦ |
|
272 | β¦ | |
273 | ] |
|
273 | ] | |
274 | error: null |
|
274 | error: null | |
275 |
|
275 | |||
276 | .. _create-user: |
|
276 | .. _create-user: | |
277 |
|
277 | |||
278 | create_user |
|
278 | create_user | |
279 | ^^^^^^^^^^^ |
|
279 | ^^^^^^^^^^^ | |
280 |
|
280 | |||
281 | Create new user. |
|
281 | Create new user. | |
282 | This command can only be executed using the api_key of a user with admin rights. |
|
282 | This command can only be executed using the api_key of a user with admin rights. | |
283 |
|
283 | |||
284 | INPUT:: |
|
284 | INPUT:: | |
285 |
|
285 | |||
286 | id : <id_for_response> |
|
286 | id : <id_for_response> | |
287 | api_key : "<api_key>" |
|
287 | api_key : "<api_key>" | |
288 | method : "create_user" |
|
288 | method : "create_user" | |
289 | args : { |
|
289 | args : { | |
290 | "username" : "<username>", |
|
290 | "username" : "<username>", | |
291 | "email" : "<useremail>", |
|
291 | "email" : "<useremail>", | |
292 | "password" : "<password = Optional(None)>", |
|
292 | "password" : "<password = Optional(None)>", | |
293 | "firstname" : "<firstname> = Optional(None)", |
|
293 | "firstname" : "<firstname> = Optional(None)", | |
294 | "lastname" : "<lastname> = Optional(None)", |
|
294 | "lastname" : "<lastname> = Optional(None)", | |
295 | "active" : "<bool> = Optional(True)", |
|
295 | "active" : "<bool> = Optional(True)", | |
296 | "admin" : "<bool> = Optional(False)", |
|
296 | "admin" : "<bool> = Optional(False)", | |
297 | "ldap_dn" : "<ldap_dn> = Optional(None)" |
|
297 | "ldap_dn" : "<ldap_dn> = Optional(None)" | |
298 | } |
|
298 | } | |
299 |
|
299 | |||
300 | OUTPUT:: |
|
300 | OUTPUT:: | |
301 |
|
301 | |||
302 | id : <id_given_in_input> |
|
302 | id : <id_given_in_input> | |
303 | result: { |
|
303 | result: { | |
304 | "msg" : "created new user `<username>`", |
|
304 | "msg" : "created new user `<username>`", | |
305 | "user": { |
|
305 | "user": { | |
306 | "user_id" : "<user_id>", |
|
306 | "user_id" : "<user_id>", | |
307 | "username" : "<username>", |
|
307 | "username" : "<username>", | |
308 | "firstname": "<firstname>", |
|
308 | "firstname": "<firstname>", | |
309 | "lastname" : "<lastname>", |
|
309 | "lastname" : "<lastname>", | |
310 | "email" : "<email>", |
|
310 | "email" : "<email>", | |
311 | "emails": "<list_of_all_additional_emails>", |
|
311 | "emails": "<list_of_all_additional_emails>", | |
312 | "active" : "<bool>", |
|
312 | "active" : "<bool>", | |
313 | "admin" :Β "<bool>", |
|
313 | "admin" :Β "<bool>", | |
314 | "ldap_dn" : "<ldap_dn>", |
|
314 | "ldap_dn" : "<ldap_dn>", | |
315 | "last_login": "<last_login>", |
|
315 | "last_login": "<last_login>", | |
316 | }, |
|
316 | }, | |
317 | } |
|
317 | } | |
318 | error: null |
|
318 | error: null | |
319 |
|
319 | |||
320 | Example:: |
|
320 | Example:: | |
321 |
|
321 | |||
322 | 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 | 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 | |
323 |
|
323 | |||
324 | update_user |
|
324 | update_user | |
325 | ^^^^^^^^^^^ |
|
325 | ^^^^^^^^^^^ | |
326 |
|
326 | |||
327 | Update the given user if such user exists. |
|
327 | Update the given user if such user exists. | |
328 | This command can only be executed using the api_key of a user with admin rights. |
|
328 | This command can only be executed using the api_key of a user with admin rights. | |
329 |
|
329 | |||
330 | INPUT:: |
|
330 | INPUT:: | |
331 |
|
331 | |||
332 | id : <id_for_response> |
|
332 | id : <id_for_response> | |
333 | api_key : "<api_key>" |
|
333 | api_key : "<api_key>" | |
334 | method : "update_user" |
|
334 | method : "update_user" | |
335 | args : { |
|
335 | args : { | |
336 | "userid" : "<user_id or username>", |
|
336 | "userid" : "<user_id or username>", | |
337 | "username" : "<username> = Optional(None)", |
|
337 | "username" : "<username> = Optional(None)", | |
338 | "email" : "<useremail> = Optional(None)", |
|
338 | "email" : "<useremail> = Optional(None)", | |
339 | "password" : "<password> = Optional(None)", |
|
339 | "password" : "<password> = Optional(None)", | |
340 | "firstname" : "<firstname> = Optional(None)", |
|
340 | "firstname" : "<firstname> = Optional(None)", | |
341 | "lastname" : "<lastname> = Optional(None)", |
|
341 | "lastname" : "<lastname> = Optional(None)", | |
342 | "active" : "<bool> = Optional(None)", |
|
342 | "active" : "<bool> = Optional(None)", | |
343 | "admin" : "<bool> = Optional(None)", |
|
343 | "admin" : "<bool> = Optional(None)", | |
344 | "ldap_dn" : "<ldap_dn> = Optional(None)" |
|
344 | "ldap_dn" : "<ldap_dn> = Optional(None)" | |
345 | } |
|
345 | } | |
346 |
|
346 | |||
347 | OUTPUT:: |
|
347 | OUTPUT:: | |
348 |
|
348 | |||
349 | id : <id_given_in_input> |
|
349 | id : <id_given_in_input> | |
350 | result: { |
|
350 | result: { | |
351 | "msg" : "updated user ID:<userid> <username>", |
|
351 | "msg" : "updated user ID:<userid> <username>", | |
352 | "user": { |
|
352 | "user": { | |
353 | "user_id" : "<user_id>", |
|
353 | "user_id" : "<user_id>", | |
354 | "api_key" : "<api_key>", |
|
354 | "api_key" : "<api_key>", | |
355 | "username" : "<username>", |
|
355 | "username" : "<username>", | |
356 | "firstname": "<firstname>", |
|
356 | "firstname": "<firstname>", | |
357 | "lastname" : "<lastname>", |
|
357 | "lastname" : "<lastname>", | |
358 | "email" : "<email>", |
|
358 | "email" : "<email>", | |
359 | "emails": "<list_of_all_additional_emails>", |
|
359 | "emails": "<list_of_all_additional_emails>", | |
360 | "active" : "<bool>", |
|
360 | "active" : "<bool>", | |
361 | "admin" :Β "<bool>", |
|
361 | "admin" :Β "<bool>", | |
362 | "ldap_dn" : "<ldap_dn>", |
|
362 | "ldap_dn" : "<ldap_dn>", | |
363 | "last_login": "<last_login>", |
|
363 | "last_login": "<last_login>", | |
364 | }, |
|
364 | }, | |
365 | } |
|
365 | } | |
366 | error: null |
|
366 | error: null | |
367 |
|
367 | |||
368 | delete_user |
|
368 | delete_user | |
369 | ^^^^^^^^^^^ |
|
369 | ^^^^^^^^^^^ | |
370 |
|
370 | |||
371 | Delete the given user if such a user exists. |
|
371 | Delete the given user if such a user exists. | |
372 | This command can only be executed using the api_key of a user with admin rights. |
|
372 | This command can only be executed using the api_key of a user with admin rights. | |
373 |
|
373 | |||
374 | INPUT:: |
|
374 | INPUT:: | |
375 |
|
375 | |||
376 | id : <id_for_response> |
|
376 | id : <id_for_response> | |
377 | api_key : "<api_key>" |
|
377 | api_key : "<api_key>" | |
378 | method : "delete_user" |
|
378 | method : "delete_user" | |
379 | args : { |
|
379 | args : { | |
380 | "userid" : "<user_id or username>", |
|
380 | "userid" : "<user_id or username>", | |
381 | } |
|
381 | } | |
382 |
|
382 | |||
383 | OUTPUT:: |
|
383 | OUTPUT:: | |
384 |
|
384 | |||
385 | id : <id_given_in_input> |
|
385 | id : <id_given_in_input> | |
386 | result: { |
|
386 | result: { | |
387 | "msg" : "deleted user ID:<userid> <username>", |
|
387 | "msg" : "deleted user ID:<userid> <username>", | |
388 | "user": null |
|
388 | "user": null | |
389 | } |
|
389 | } | |
390 | error: null |
|
390 | error: null | |
391 |
|
391 | |||
392 | get_user_group |
|
392 | get_user_group | |
393 | ^^^^^^^^^^^^^^ |
|
393 | ^^^^^^^^^^^^^^ | |
394 |
|
394 | |||
395 | Get an existing user group. |
|
395 | Get an existing user group. | |
396 | This command can only be executed using the api_key of a user with admin rights. |
|
396 | This command can only be executed using the api_key of a user with admin rights. | |
397 |
|
397 | |||
398 | INPUT:: |
|
398 | INPUT:: | |
399 |
|
399 | |||
400 | id : <id_for_response> |
|
400 | id : <id_for_response> | |
401 | api_key : "<api_key>" |
|
401 | api_key : "<api_key>" | |
402 | method : "get_user_group" |
|
402 | method : "get_user_group" | |
403 | args : { |
|
403 | args : { | |
404 | "usergroupid" : "<user group id or name>" |
|
404 | "usergroupid" : "<user group id or name>" | |
405 | } |
|
405 | } | |
406 |
|
406 | |||
407 | OUTPUT:: |
|
407 | OUTPUT:: | |
408 |
|
408 | |||
409 | id : <id_given_in_input> |
|
409 | id : <id_given_in_input> | |
410 | result : None if group not exist |
|
410 | result : None if group not exist | |
411 | { |
|
411 | { | |
412 | "users_group_id" : "<id>", |
|
412 | "users_group_id" : "<id>", | |
413 | "group_name" : "<groupname>", |
|
413 | "group_name" : "<groupname>", | |
414 | "active": "<bool>", |
|
414 | "active": "<bool>", | |
415 | "members" : [ |
|
415 | "members" : [ | |
416 | { |
|
416 | { | |
417 | "user_id" : "<user_id>", |
|
417 | "user_id" : "<user_id>", | |
418 | "api_key" : "<api_key>", |
|
418 | "api_key" : "<api_key>", | |
419 | "username" : "<username>", |
|
419 | "username" : "<username>", | |
420 | "firstname": "<firstname>", |
|
420 | "firstname": "<firstname>", | |
421 | "lastname" : "<lastname>", |
|
421 | "lastname" : "<lastname>", | |
422 | "email" : "<email>", |
|
422 | "email" : "<email>", | |
423 | "emails": "<list_of_all_additional_emails>", |
|
423 | "emails": "<list_of_all_additional_emails>", | |
424 | "active" : "<bool>", |
|
424 | "active" : "<bool>", | |
425 | "admin" :Β "<bool>", |
|
425 | "admin" :Β "<bool>", | |
426 | "ldap_dn" : "<ldap_dn>", |
|
426 | "ldap_dn" : "<ldap_dn>", | |
427 | "last_login": "<last_login>", |
|
427 | "last_login": "<last_login>", | |
428 | }, |
|
428 | }, | |
429 | β¦ |
|
429 | β¦ | |
430 | ] |
|
430 | ] | |
431 | } |
|
431 | } | |
432 | error : null |
|
432 | error : null | |
433 |
|
433 | |||
434 | get_user_groups |
|
434 | get_user_groups | |
435 | ^^^^^^^^^^^^^^^ |
|
435 | ^^^^^^^^^^^^^^^ | |
436 |
|
436 | |||
437 | List all existing user groups. |
|
437 | List all existing user groups. | |
438 | This command can only be executed using the api_key of a user with admin rights. |
|
438 | This command can only be executed using the api_key of a user with admin rights. | |
439 |
|
439 | |||
440 | INPUT:: |
|
440 | INPUT:: | |
441 |
|
441 | |||
442 | id : <id_for_response> |
|
442 | id : <id_for_response> | |
443 | api_key : "<api_key>" |
|
443 | api_key : "<api_key>" | |
444 | method : "get_user_groups" |
|
444 | method : "get_user_groups" | |
445 | args : { } |
|
445 | args : { } | |
446 |
|
446 | |||
447 | OUTPUT:: |
|
447 | OUTPUT:: | |
448 |
|
448 | |||
449 | id : <id_given_in_input> |
|
449 | id : <id_given_in_input> | |
450 | result : [ |
|
450 | result : [ | |
451 | { |
|
451 | { | |
452 | "users_group_id" : "<id>", |
|
452 | "users_group_id" : "<id>", | |
453 | "group_name" : "<groupname>", |
|
453 | "group_name" : "<groupname>", | |
454 | "active": "<bool>", |
|
454 | "active": "<bool>", | |
455 | }, |
|
455 | }, | |
456 | β¦ |
|
456 | β¦ | |
457 | ] |
|
457 | ] | |
458 | error : null |
|
458 | error : null | |
459 |
|
459 | |||
460 | create_user_group |
|
460 | create_user_group | |
461 | ^^^^^^^^^^^^^^^^^ |
|
461 | ^^^^^^^^^^^^^^^^^ | |
462 |
|
462 | |||
463 | Create a new user group. |
|
463 | Create a new user group. | |
464 | This command can only be executed using the api_key of a user with admin rights. |
|
464 | This command can only be executed using the api_key of a user with admin rights. | |
465 |
|
465 | |||
466 | INPUT:: |
|
466 | INPUT:: | |
467 |
|
467 | |||
468 | id : <id_for_response> |
|
468 | id : <id_for_response> | |
469 | api_key : "<api_key>" |
|
469 | api_key : "<api_key>" | |
470 | method : "create_user_group" |
|
470 | method : "create_user_group" | |
471 | args: { |
|
471 | args: { | |
472 | "group_name": "<groupname>", |
|
472 | "group_name": "<groupname>", | |
473 | "owner" : "<owner_name_or_id = Optional(=apiuser)>", |
|
473 | "owner" : "<owner_name_or_id = Optional(=apiuser)>", | |
474 | "active": "<bool> = Optional(True)" |
|
474 | "active": "<bool> = Optional(True)" | |
475 | } |
|
475 | } | |
476 |
|
476 | |||
477 | OUTPUT:: |
|
477 | OUTPUT:: | |
478 |
|
478 | |||
479 | id : <id_given_in_input> |
|
479 | id : <id_given_in_input> | |
480 | result: { |
|
480 | result: { | |
481 | "msg": "created new user group `<groupname>`", |
|
481 | "msg": "created new user group `<groupname>`", | |
482 | "users_group": { |
|
482 | "users_group": { | |
483 | "users_group_id" : "<id>", |
|
483 | "users_group_id" : "<id>", | |
484 | "group_name" : "<groupname>", |
|
484 | "group_name" : "<groupname>", | |
485 | "active": "<bool>", |
|
485 | "active": "<bool>", | |
486 | }, |
|
486 | }, | |
487 | } |
|
487 | } | |
488 | error: null |
|
488 | error: null | |
489 |
|
489 | |||
490 | add_user_to_user_group |
|
490 | add_user_to_user_group | |
491 | ^^^^^^^^^^^^^^^^^^^^^^ |
|
491 | ^^^^^^^^^^^^^^^^^^^^^^ | |
492 |
|
492 | |||
493 | Adds a user to a user group. If the user already is in that group, success will be |
|
493 | Adds a user to a user group. If the user already is in that group, success will be | |
494 | ``false``. |
|
494 | ``false``. | |
495 | This command can only be executed using the api_key of a user with admin rights. |
|
495 | This command can only be executed using the api_key of a user with admin rights. | |
496 |
|
496 | |||
497 | INPUT:: |
|
497 | INPUT:: | |
498 |
|
498 | |||
499 | id : <id_for_response> |
|
499 | id : <id_for_response> | |
500 | api_key : "<api_key>" |
|
500 | api_key : "<api_key>" | |
501 | method : "add_user_user_group" |
|
501 | method : "add_user_user_group" | |
502 | args: { |
|
502 | args: { | |
503 | "usersgroupid" : "<user group id or name>", |
|
503 | "usersgroupid" : "<user group id or name>", | |
504 | "userid" : "<user_id or username>", |
|
504 | "userid" : "<user_id or username>", | |
505 | } |
|
505 | } | |
506 |
|
506 | |||
507 | OUTPUT:: |
|
507 | OUTPUT:: | |
508 |
|
508 | |||
509 | id : <id_given_in_input> |
|
509 | id : <id_given_in_input> | |
510 | result: { |
|
510 | result: { | |
511 | "success": True|False # depends on if member is in group |
|
511 | "success": True|False # depends on if member is in group | |
512 | "msg": "added member `<username>` to a user group `<groupname>` | |
|
512 | "msg": "added member `<username>` to a user group `<groupname>` | | |
513 | User is already in that group" |
|
513 | User is already in that group" | |
514 | } |
|
514 | } | |
515 | error: null |
|
515 | error: null | |
516 |
|
516 | |||
517 | remove_user_from_user_group |
|
517 | remove_user_from_user_group | |
518 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
518 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
519 |
|
519 | |||
520 | Remove a user from a user group. If the user isn't in the given group, success will |
|
520 | Remove a user from a user group. If the user isn't in the given group, success will | |
521 | be ``false``. |
|
521 | be ``false``. | |
522 | This command can only be executed using the api_key of a user with admin rights. |
|
522 | This command can only be executed using the api_key of a user with admin rights. | |
523 |
|
523 | |||
524 | INPUT:: |
|
524 | INPUT:: | |
525 |
|
525 | |||
526 | id : <id_for_response> |
|
526 | id : <id_for_response> | |
527 | api_key : "<api_key>" |
|
527 | api_key : "<api_key>" | |
528 | method : "remove_user_from_user_group" |
|
528 | method : "remove_user_from_user_group" | |
529 | args: { |
|
529 | args: { | |
530 | "usersgroupid" : "<user group id or name>", |
|
530 | "usersgroupid" : "<user group id or name>", | |
531 | "userid" : "<user_id or username>", |
|
531 | "userid" : "<user_id or username>", | |
532 | } |
|
532 | } | |
533 |
|
533 | |||
534 | OUTPUT:: |
|
534 | OUTPUT:: | |
535 |
|
535 | |||
536 | id : <id_given_in_input> |
|
536 | id : <id_given_in_input> | |
537 | result: { |
|
537 | result: { | |
538 | "success": True|False, # depends on if member is in group |
|
538 | "success": True|False, # depends on if member is in group | |
539 | "msg": "removed member <username> from user group <groupname> | |
|
539 | "msg": "removed member <username> from user group <groupname> | | |
540 | User wasn't in group" |
|
540 | User wasn't in group" | |
541 | } |
|
541 | } | |
542 | error: null |
|
542 | error: null | |
543 |
|
543 | |||
544 | get_repo |
|
544 | get_repo | |
545 | ^^^^^^^^ |
|
545 | ^^^^^^^^ | |
546 |
|
546 | |||
547 | Get an existing repository by its name or repository_id. Members will contain |
|
547 | Get an existing repository by its name or repository_id. Members will contain | |
548 | either users_group or users associated to that repository. |
|
548 | either users_group or users associated to that repository. | |
549 | This command can only be executed using the api_key of a user with admin rights, |
|
549 | This command can only be executed using the api_key of a user with admin rights, | |
550 | or that of a regular user with at least read access to the repository. |
|
550 | or that of a regular user with at least read access to the repository. | |
551 |
|
551 | |||
552 | INPUT:: |
|
552 | INPUT:: | |
553 |
|
553 | |||
554 | id : <id_for_response> |
|
554 | id : <id_for_response> | |
555 | api_key : "<api_key>" |
|
555 | api_key : "<api_key>" | |
556 | method : "get_repo" |
|
556 | method : "get_repo" | |
557 | args: { |
|
557 | args: { | |
558 | "repoid" : "<reponame or repo_id>", |
|
558 | "repoid" : "<reponame or repo_id>", | |
559 | "with_revision_names": "<bool> = Optional(False)", |
|
559 | "with_revision_names": "<bool> = Optional(False)", | |
560 | "with_pullrequests": "<bool> = Optional(False)", |
|
560 | "with_pullrequests": "<bool> = Optional(False)", | |
561 | } |
|
561 | } | |
562 |
|
562 | |||
563 | OUTPUT:: |
|
563 | OUTPUT:: | |
564 |
|
564 | |||
565 | id : <id_given_in_input> |
|
565 | id : <id_given_in_input> | |
566 | result: None if repository does not exist or |
|
566 | result: None if repository does not exist or | |
567 | { |
|
567 | { | |
568 | "repo_id" : "<repo_id>", |
|
568 | "repo_id" : "<repo_id>", | |
569 | "repo_name" : "<reponame>" |
|
569 | "repo_name" : "<reponame>" | |
570 | "repo_type" : "<repo_type>", |
|
570 | "repo_type" : "<repo_type>", | |
571 | "clone_uri" : "<clone_uri>", |
|
571 | "clone_uri" : "<clone_uri>", | |
572 | "enable_downloads": "<bool>", |
|
572 | "enable_downloads": "<bool>", | |
573 | "enable_statistics": "<bool>", |
|
573 | "enable_statistics": "<bool>", | |
574 | "private": "<bool>", |
|
574 | "private": "<bool>", | |
575 | "created_on" : "<date_time_created>", |
|
575 | "created_on" : "<date_time_created>", | |
576 | "description" : "<description>", |
|
576 | "description" : "<description>", | |
577 | "landing_rev": "<landing_rev>", |
|
577 | "landing_rev": "<landing_rev>", | |
578 | "last_changeset": { |
|
578 | "last_changeset": { | |
579 | "author": "<full_author>", |
|
579 | "author": "<full_author>", | |
580 | "date": "<date_time_of_commit>", |
|
580 | "date": "<date_time_of_commit>", | |
581 | "message": "<commit_message>", |
|
581 | "message": "<commit_message>", | |
582 | "raw_id": "<raw_id>", |
|
582 | "raw_id": "<raw_id>", | |
583 | "revision": "<numeric_revision>", |
|
583 | "revision": "<numeric_revision>", | |
584 | "short_id": "<short_id>" |
|
584 | "short_id": "<short_id>" | |
585 | }, |
|
585 | }, | |
586 | "owner": "<repo_owner>", |
|
586 | "owner": "<repo_owner>", | |
587 | "fork_of": "<name_of_fork_parent>", |
|
587 | "fork_of": "<name_of_fork_parent>", | |
588 | "members" : [ |
|
588 | "members" : [ | |
589 | { |
|
589 | { | |
590 | "type": "user", |
|
590 | "type": "user", | |
591 | "user_id" : "<user_id>", |
|
591 | "user_id" : "<user_id>", | |
592 | "api_key" : "<api_key>", |
|
592 | "api_key" : "<api_key>", | |
593 | "username" : "<username>", |
|
593 | "username" : "<username>", | |
594 | "firstname": "<firstname>", |
|
594 | "firstname": "<firstname>", | |
595 | "lastname" : "<lastname>", |
|
595 | "lastname" : "<lastname>", | |
596 | "email" : "<email>", |
|
596 | "email" : "<email>", | |
597 | "emails": "<list_of_all_additional_emails>", |
|
597 | "emails": "<list_of_all_additional_emails>", | |
598 | "active" : "<bool>", |
|
598 | "active" : "<bool>", | |
599 | "admin" :Β "<bool>", |
|
599 | "admin" :Β "<bool>", | |
600 | "ldap_dn" : "<ldap_dn>", |
|
600 | "ldap_dn" : "<ldap_dn>", | |
601 | "last_login": "<last_login>", |
|
601 | "last_login": "<last_login>", | |
602 | "permission" : "repository.(read|write|admin)" |
|
602 | "permission" : "repository.(read|write|admin)" | |
603 | }, |
|
603 | }, | |
604 | β¦ |
|
604 | β¦ | |
605 | { |
|
605 | { | |
606 | "type": "users_group", |
|
606 | "type": "users_group", | |
607 | "id" : "<usersgroupid>", |
|
607 | "id" : "<usersgroupid>", | |
608 | "name" : "<usersgroupname>", |
|
608 | "name" : "<usersgroupname>", | |
609 | "active": "<bool>", |
|
609 | "active": "<bool>", | |
610 | "permission" : "repository.(read|write|admin)" |
|
610 | "permission" : "repository.(read|write|admin)" | |
611 | }, |
|
611 | }, | |
612 | β¦ |
|
612 | β¦ | |
613 | ], |
|
613 | ], | |
614 | "followers": [ |
|
614 | "followers": [ | |
615 | { |
|
615 | { | |
616 | "user_id" : "<user_id>", |
|
616 | "user_id" : "<user_id>", | |
617 | "username" : "<username>", |
|
617 | "username" : "<username>", | |
618 | "api_key" : "<api_key>", |
|
618 | "api_key" : "<api_key>", | |
619 | "firstname": "<firstname>", |
|
619 | "firstname": "<firstname>", | |
620 | "lastname" : "<lastname>", |
|
620 | "lastname" : "<lastname>", | |
621 | "email" : "<email>", |
|
621 | "email" : "<email>", | |
622 | "emails": "<list_of_all_additional_emails>", |
|
622 | "emails": "<list_of_all_additional_emails>", | |
623 | "ip_addresses": "<list_of_ip_addresses_for_user>", |
|
623 | "ip_addresses": "<list_of_ip_addresses_for_user>", | |
624 | "active" : "<bool>", |
|
624 | "active" : "<bool>", | |
625 | "admin" :Β "<bool>", |
|
625 | "admin" :Β "<bool>", | |
626 | "ldap_dn" : "<ldap_dn>", |
|
626 | "ldap_dn" : "<ldap_dn>", | |
627 | "last_login": "<last_login>", |
|
627 | "last_login": "<last_login>", | |
628 | }, |
|
628 | }, | |
629 | β¦ |
|
629 | β¦ | |
630 | ], |
|
630 | ], | |
631 | <if with_revision_names == True> |
|
631 | <if with_revision_names == True> | |
632 | "tags": { |
|
632 | "tags": { | |
633 | "<tagname>": "<raw_id>", |
|
633 | "<tagname>": "<raw_id>", | |
634 | ... |
|
634 | ... | |
635 | }, |
|
635 | }, | |
636 | "branches": { |
|
636 | "branches": { | |
637 | "<branchname>": "<raw_id>", |
|
637 | "<branchname>": "<raw_id>", | |
638 | ... |
|
638 | ... | |
639 | }, |
|
639 | }, | |
640 | "bookmarks": { |
|
640 | "bookmarks": { | |
641 | "<bookmarkname>": "<raw_id>", |
|
641 | "<bookmarkname>": "<raw_id>", | |
642 | ... |
|
642 | ... | |
643 | }, |
|
643 | }, | |
644 | <if with_pullrequests == True> |
|
644 | <if with_pullrequests == True> | |
645 | "pull_requests": [ |
|
645 | "pull_requests": [ | |
646 | { |
|
646 | { | |
647 | "status": "<pull_request_status>", |
|
647 | "status": "<pull_request_status>", | |
648 | "pull_request_id": <pull_request_id>, |
|
648 | "pull_request_id": <pull_request_id>, | |
649 | "description": "<pull_request_description>", |
|
649 | "description": "<pull_request_description>", | |
650 | "title": "<pull_request_title>", |
|
650 | "title": "<pull_request_title>", | |
651 | "url": "<pull_request_url>", |
|
651 | "url": "<pull_request_url>", | |
652 | "reviewers": [ |
|
652 | "reviewers": [ | |
653 | { |
|
653 | { | |
654 | "username": "<user_id>", |
|
654 | "username": "<user_id>", | |
655 | }, |
|
655 | }, | |
656 | ... |
|
656 | ... | |
657 | ], |
|
657 | ], | |
658 | "org_repo_url": "<repo_url>", |
|
658 | "org_repo_url": "<repo_url>", | |
659 | "org_ref_parts": [ |
|
659 | "org_ref_parts": [ | |
660 | "<ref_type>", |
|
660 | "<ref_type>", | |
661 | "<ref_name>", |
|
661 | "<ref_name>", | |
662 | "<raw_id>" |
|
662 | "<raw_id>" | |
663 | ], |
|
663 | ], | |
664 | "other_ref_parts": [ |
|
664 | "other_ref_parts": [ | |
665 | "<ref_type>", |
|
665 | "<ref_type>", | |
666 | "<ref_name>", |
|
666 | "<ref_name>", | |
667 | "<raw_id>" |
|
667 | "<raw_id>" | |
668 | ], |
|
668 | ], | |
669 | "comments": [ |
|
669 | "comments": [ | |
670 | { |
|
670 | { | |
671 | "username": "<user_id>", |
|
671 | "username": "<user_id>", | |
672 | "text": "<comment text>", |
|
672 | "text": "<comment text>", | |
673 | "comment_id": "<comment_id>", |
|
673 | "comment_id": "<comment_id>", | |
674 | }, |
|
674 | }, | |
675 | ... |
|
675 | ... | |
676 | ], |
|
676 | ], | |
677 | "owner": "<username>", |
|
677 | "owner": "<username>", | |
678 | "statuses": [ |
|
678 | "statuses": [ | |
679 | { |
|
679 | { | |
680 | "status": "<status_of_review>", # "under_review", "approved" or "rejected" |
|
680 | "status": "<status_of_review>", # "under_review", "approved" or "rejected" | |
681 | "reviewer": "<user_id>", |
|
681 | "reviewer": "<user_id>", | |
682 | "modified_at": "<date_time_of_review>" # iso 8601 date, server's timezone |
|
682 | "modified_at": "<date_time_of_review>" # iso 8601 date, server's timezone | |
683 | }, |
|
683 | }, | |
684 | ... |
|
684 | ... | |
685 | ], |
|
685 | ], | |
686 | "revisions": [ |
|
686 | "revisions": [ | |
687 | "<raw_id>", |
|
687 | "<raw_id>", | |
688 | ... |
|
688 | ... | |
689 | ] |
|
689 | ] | |
690 | }, |
|
690 | }, | |
691 | ... |
|
691 | ... | |
692 | ] |
|
692 | ] | |
693 | } |
|
693 | } | |
694 | error: null |
|
694 | error: null | |
695 |
|
695 | |||
696 | get_repos |
|
696 | get_repos | |
697 | ^^^^^^^^^ |
|
697 | ^^^^^^^^^ | |
698 |
|
698 | |||
699 | List all existing repositories. |
|
699 | List all existing repositories. | |
700 | This command can only be executed using the api_key of a user with admin rights, |
|
700 | This command can only be executed using the api_key of a user with admin rights, | |
701 | or that of a regular user with at least read access to the repository. |
|
701 | or that of a regular user with at least read access to the repository. | |
702 |
|
702 | |||
703 | INPUT:: |
|
703 | INPUT:: | |
704 |
|
704 | |||
705 | id : <id_for_response> |
|
705 | id : <id_for_response> | |
706 | api_key : "<api_key>" |
|
706 | api_key : "<api_key>" | |
707 | method : "get_repos" |
|
707 | method : "get_repos" | |
708 | args: { } |
|
708 | args: { } | |
709 |
|
709 | |||
710 | OUTPUT:: |
|
710 | OUTPUT:: | |
711 |
|
711 | |||
712 | id : <id_given_in_input> |
|
712 | id : <id_given_in_input> | |
713 | result: [ |
|
713 | result: [ | |
714 | { |
|
714 | { | |
715 | "repo_id" : "<repo_id>", |
|
715 | "repo_id" : "<repo_id>", | |
716 | "repo_name" : "<reponame>" |
|
716 | "repo_name" : "<reponame>" | |
717 | "repo_type" : "<repo_type>", |
|
717 | "repo_type" : "<repo_type>", | |
718 | "clone_uri" : "<clone_uri>", |
|
718 | "clone_uri" : "<clone_uri>", | |
719 | "private" : "<bool>", |
|
719 | "private" : "<bool>", | |
720 | "created_on" : "<datetimecreated>", |
|
720 | "created_on" : "<datetimecreated>", | |
721 | "description" : "<description>", |
|
721 | "description" : "<description>", | |
722 | "landing_rev": "<landing_rev>", |
|
722 | "landing_rev": "<landing_rev>", | |
723 | "owner": "<repo_owner>", |
|
723 | "owner": "<repo_owner>", | |
724 | "fork_of": "<name_of_fork_parent>", |
|
724 | "fork_of": "<name_of_fork_parent>", | |
725 | "enable_downloads": "<bool>", |
|
725 | "enable_downloads": "<bool>", | |
726 | "enable_statistics": "<bool>", |
|
726 | "enable_statistics": "<bool>", | |
727 | }, |
|
727 | }, | |
728 | β¦ |
|
728 | β¦ | |
729 | ] |
|
729 | ] | |
730 | error: null |
|
730 | error: null | |
731 |
|
731 | |||
732 | get_repo_nodes |
|
732 | get_repo_nodes | |
733 | ^^^^^^^^^^^^^^ |
|
733 | ^^^^^^^^^^^^^^ | |
734 |
|
734 | |||
735 | Return a list of files and directories for a given path at the given revision. |
|
735 | Return a list of files and directories for a given path at the given revision. | |
736 | It is possible to specify ret_type to show only ``files`` or ``dirs``. |
|
736 | It is possible to specify ret_type to show only ``files`` or ``dirs``. | |
737 | This command can only be executed using the api_key of a user with admin rights. |
|
737 | This command can only be executed using the api_key of a user with admin rights. | |
738 |
|
738 | |||
739 | INPUT:: |
|
739 | INPUT:: | |
740 |
|
740 | |||
741 | id : <id_for_response> |
|
741 | id : <id_for_response> | |
742 | api_key : "<api_key>" |
|
742 | api_key : "<api_key>" | |
743 | method : "get_repo_nodes" |
|
743 | method : "get_repo_nodes" | |
744 | args: { |
|
744 | args: { | |
745 | "repoid" : "<reponame or repo_id>" |
|
745 | "repoid" : "<reponame or repo_id>" | |
746 | "revision" : "<revision>", |
|
746 | "revision" : "<revision>", | |
747 | "root_path" : "<root_path>", |
|
747 | "root_path" : "<root_path>", | |
748 | "ret_type" : "<ret_type> = Optional('all')" |
|
748 | "ret_type" : "<ret_type> = Optional('all')" | |
749 | } |
|
749 | } | |
750 |
|
750 | |||
751 | OUTPUT:: |
|
751 | OUTPUT:: | |
752 |
|
752 | |||
753 | id : <id_given_in_input> |
|
753 | id : <id_given_in_input> | |
754 | result: [ |
|
754 | result: [ | |
755 | { |
|
755 | { | |
756 | "name" : "<name>" |
|
756 | "name" : "<name>" | |
757 | "type" : "<type>", |
|
757 | "type" : "<type>", | |
758 | }, |
|
758 | }, | |
759 | β¦ |
|
759 | β¦ | |
760 | ] |
|
760 | ] | |
761 | error: null |
|
761 | error: null | |
762 |
|
762 | |||
763 | create_repo |
|
763 | create_repo | |
764 | ^^^^^^^^^^^ |
|
764 | ^^^^^^^^^^^ | |
765 |
|
765 | |||
766 | Create a repository. If the repository name contains "/", the repository will be |
|
766 | Create a repository. If the repository name contains "/", the repository will be | |
767 | created in the repository group indicated by that path. Any such repository |
|
767 | created in the repository group indicated by that path. Any such repository | |
768 | groups need to exist before calling this method, or the call will fail. |
|
768 | groups need to exist before calling this method, or the call will fail. | |
769 | For example "foo/bar/baz" will create a repository "baz" inside the repository |
|
769 | For example "foo/bar/baz" will create a repository "baz" inside the repository | |
770 | group "bar" which itself is in a repository group "foo", but both "foo" and |
|
770 | group "bar" which itself is in a repository group "foo", but both "foo" and | |
771 | "bar" already need to exist before calling this method. |
|
771 | "bar" already need to exist before calling this method. | |
772 | This command can only be executed using the api_key of a user with admin rights, |
|
772 | This command can only be executed using the api_key of a user with admin rights, | |
773 | or that of a regular user with create repository permission. |
|
773 | or that of a regular user with create repository permission. | |
774 | Regular users cannot specify owner parameter. |
|
774 | Regular users cannot specify owner parameter. | |
775 |
|
775 | |||
776 | INPUT:: |
|
776 | INPUT:: | |
777 |
|
777 | |||
778 | id : <id_for_response> |
|
778 | id : <id_for_response> | |
779 | api_key : "<api_key>" |
|
779 | api_key : "<api_key>" | |
780 | method : "create_repo" |
|
780 | method : "create_repo" | |
781 | args: { |
|
781 | args: { | |
782 | "repo_name" : "<reponame>", |
|
782 | "repo_name" : "<reponame>", | |
783 | "owner" : "<owner_name_or_id = Optional(=apiuser)>", |
|
783 | "owner" : "<owner_name_or_id = Optional(=apiuser)>", | |
784 | "repo_type" : "<repo_type> = Optional('hg')", |
|
784 | "repo_type" : "<repo_type> = Optional('hg')", | |
785 | "description" : "<description> = Optional('')", |
|
785 | "description" : "<description> = Optional('')", | |
786 | "private" : "<bool> = Optional(False)", |
|
786 | "private" : "<bool> = Optional(False)", | |
787 | "clone_uri" : "<clone_uri> = Optional(None)", |
|
787 | "clone_uri" : "<clone_uri> = Optional(None)", | |
788 | "landing_rev" : "<landing_rev> = Optional('tip')", |
|
788 | "landing_rev" : "<landing_rev> = Optional('tip')", | |
789 | "enable_downloads": "<bool> = Optional(False)", |
|
789 | "enable_downloads": "<bool> = Optional(False)", | |
790 | "enable_statistics": "<bool> = Optional(False)", |
|
790 | "enable_statistics": "<bool> = Optional(False)", | |
791 | } |
|
791 | } | |
792 |
|
792 | |||
793 | OUTPUT:: |
|
793 | OUTPUT:: | |
794 |
|
794 | |||
795 | id : <id_given_in_input> |
|
795 | id : <id_given_in_input> | |
796 | result: { |
|
796 | result: { | |
797 | "msg": "Created new repository `<reponame>`", |
|
797 | "msg": "Created new repository `<reponame>`", | |
798 | "repo": { |
|
798 | "repo": { | |
799 | "repo_id" : "<repo_id>", |
|
799 | "repo_id" : "<repo_id>", | |
800 | "repo_name" : "<reponame>" |
|
800 | "repo_name" : "<reponame>" | |
801 | "repo_type" : "<repo_type>", |
|
801 | "repo_type" : "<repo_type>", | |
802 | "clone_uri" : "<clone_uri>", |
|
802 | "clone_uri" : "<clone_uri>", | |
803 | "private" : "<bool>", |
|
803 | "private" : "<bool>", | |
804 | "created_on" : "<datetimecreated>", |
|
804 | "created_on" : "<datetimecreated>", | |
805 | "description" : "<description>", |
|
805 | "description" : "<description>", | |
806 | "landing_rev": "<landing_rev>", |
|
806 | "landing_rev": "<landing_rev>", | |
807 | "owner": "<username or user_id>", |
|
807 | "owner": "<username or user_id>", | |
808 | "fork_of": "<name_of_fork_parent>", |
|
808 | "fork_of": "<name_of_fork_parent>", | |
809 | "enable_downloads": "<bool>", |
|
809 | "enable_downloads": "<bool>", | |
810 | "enable_statistics": "<bool>", |
|
810 | "enable_statistics": "<bool>", | |
811 | }, |
|
811 | }, | |
812 | } |
|
812 | } | |
813 | error: null |
|
813 | error: null | |
814 |
|
814 | |||
815 | update_repo |
|
815 | update_repo | |
816 | ^^^^^^^^^^^ |
|
816 | ^^^^^^^^^^^ | |
817 |
|
817 | |||
818 | Update a repository. |
|
818 | Update a repository. | |
819 | This command can only be executed using the api_key of a user with admin rights, |
|
819 | This command can only be executed using the api_key of a user with admin rights, | |
820 | or that of a regular user with create repository permission. |
|
820 | or that of a regular user with create repository permission. | |
821 | Regular users cannot specify owner parameter. |
|
821 | Regular users cannot specify owner parameter. | |
822 |
|
822 | |||
823 | INPUT:: |
|
823 | INPUT:: | |
824 |
|
824 | |||
825 | id : <id_for_response> |
|
825 | id : <id_for_response> | |
826 | api_key : "<api_key>" |
|
826 | api_key : "<api_key>" | |
827 | method : "update_repo" |
|
827 | method : "update_repo" | |
828 | args: { |
|
828 | args: { | |
829 | "repoid" : "<reponame or repo_id>" |
|
829 | "repoid" : "<reponame or repo_id>" | |
830 | "name" : "<reponame> = Optional('')", |
|
830 | "name" : "<reponame> = Optional('')", | |
831 | "group" : "<group_id> = Optional(None)", |
|
831 | "group" : "<group_id> = Optional(None)", | |
832 | "owner" : "<owner_name_or_id = Optional(=apiuser)>", |
|
832 | "owner" : "<owner_name_or_id = Optional(=apiuser)>", | |
833 | "description" : "<description> = Optional('')", |
|
833 | "description" : "<description> = Optional('')", | |
834 | "private" : "<bool> = Optional(False)", |
|
834 | "private" : "<bool> = Optional(False)", | |
835 | "clone_uri" : "<clone_uri> = Optional(None)", |
|
835 | "clone_uri" : "<clone_uri> = Optional(None)", | |
836 | "landing_rev" : "<landing_rev> = Optional('tip')", |
|
836 | "landing_rev" : "<landing_rev> = Optional('tip')", | |
837 | "enable_downloads": "<bool> = Optional(False)", |
|
837 | "enable_downloads": "<bool> = Optional(False)", | |
838 | "enable_statistics": "<bool> = Optional(False)", |
|
838 | "enable_statistics": "<bool> = Optional(False)", | |
839 | } |
|
839 | } | |
840 |
|
840 | |||
841 | OUTPUT:: |
|
841 | OUTPUT:: | |
842 |
|
842 | |||
843 | id : <id_given_in_input> |
|
843 | id : <id_given_in_input> | |
844 | result: { |
|
844 | result: { | |
845 | "msg": "updated repo ID:repo_id `<reponame>`", |
|
845 | "msg": "updated repo ID:repo_id `<reponame>`", | |
846 | "repository": { |
|
846 | "repository": { | |
847 | "repo_id" : "<repo_id>", |
|
847 | "repo_id" : "<repo_id>", | |
848 | "repo_name" : "<reponame>" |
|
848 | "repo_name" : "<reponame>" | |
849 | "repo_type" : "<repo_type>", |
|
849 | "repo_type" : "<repo_type>", | |
850 | "clone_uri" : "<clone_uri>", |
|
850 | "clone_uri" : "<clone_uri>", | |
851 | "private": "<bool>", |
|
851 | "private": "<bool>", | |
852 | "created_on" : "<datetimecreated>", |
|
852 | "created_on" : "<datetimecreated>", | |
853 | "description" : "<description>", |
|
853 | "description" : "<description>", | |
854 | "landing_rev": "<landing_rev>", |
|
854 | "landing_rev": "<landing_rev>", | |
855 | "owner": "<username or user_id>", |
|
855 | "owner": "<username or user_id>", | |
856 | "fork_of": "<name_of_fork_parent>", |
|
856 | "fork_of": "<name_of_fork_parent>", | |
857 | "enable_downloads": "<bool>", |
|
857 | "enable_downloads": "<bool>", | |
858 | "enable_statistics": "<bool>", |
|
858 | "enable_statistics": "<bool>", | |
859 | "last_changeset": { |
|
859 | "last_changeset": { | |
860 | "author": "<full_author>", |
|
860 | "author": "<full_author>", | |
861 | "date": "<date_time_of_commit>", |
|
861 | "date": "<date_time_of_commit>", | |
862 | "message": "<commit_message>", |
|
862 | "message": "<commit_message>", | |
863 | "raw_id": "<raw_id>", |
|
863 | "raw_id": "<raw_id>", | |
864 | "revision": "<numeric_revision>", |
|
864 | "revision": "<numeric_revision>", | |
865 | "short_id": "<short_id>" |
|
865 | "short_id": "<short_id>" | |
866 | } |
|
866 | } | |
867 | }, |
|
867 | }, | |
868 | } |
|
868 | } | |
869 | error: null |
|
869 | error: null | |
870 |
|
870 | |||
871 | fork_repo |
|
871 | fork_repo | |
872 | ^^^^^^^^^ |
|
872 | ^^^^^^^^^ | |
873 |
|
873 | |||
874 | Create a fork of the given repo. If using Celery, this will |
|
874 | Create a fork of the given repo. If using Celery, this will | |
875 | return success message immediately and a fork will be created |
|
875 | return success message immediately and a fork will be created | |
876 | asynchronously. |
|
876 | asynchronously. | |
877 | This command can only be executed using the api_key of a user with admin |
|
877 | This command can only be executed using the api_key of a user with admin | |
878 | rights, or with the global fork permission, by a regular user with create |
|
878 | rights, or with the global fork permission, by a regular user with create | |
879 | repository permission and at least read access to the repository. |
|
879 | repository permission and at least read access to the repository. | |
880 | Regular users cannot specify owner parameter. |
|
880 | Regular users cannot specify owner parameter. | |
881 |
|
881 | |||
882 | INPUT:: |
|
882 | INPUT:: | |
883 |
|
883 | |||
884 | id : <id_for_response> |
|
884 | id : <id_for_response> | |
885 | api_key : "<api_key>" |
|
885 | api_key : "<api_key>" | |
886 | method : "fork_repo" |
|
886 | method : "fork_repo" | |
887 | args: { |
|
887 | args: { | |
888 | "repoid" : "<reponame or repo_id>", |
|
888 | "repoid" : "<reponame or repo_id>", | |
889 | "fork_name": "<forkname>", |
|
889 | "fork_name": "<forkname>", | |
890 | "owner": "<username or user_id = Optional(=apiuser)>", |
|
890 | "owner": "<username or user_id = Optional(=apiuser)>", | |
891 | "description": "<description>", |
|
891 | "description": "<description>", | |
892 | "copy_permissions": "<bool>", |
|
892 | "copy_permissions": "<bool>", | |
893 | "private": "<bool>", |
|
893 | "private": "<bool>", | |
894 | "landing_rev": "<landing_rev>" |
|
894 | "landing_rev": "<landing_rev>" | |
895 |
|
895 | |||
896 | } |
|
896 | } | |
897 |
|
897 | |||
898 | OUTPUT:: |
|
898 | OUTPUT:: | |
899 |
|
899 | |||
900 | id : <id_given_in_input> |
|
900 | id : <id_given_in_input> | |
901 | result: { |
|
901 | result: { | |
902 | "msg": "Created fork of `<reponame>` as `<forkname>`", |
|
902 | "msg": "Created fork of `<reponame>` as `<forkname>`", | |
903 | "success": true |
|
903 | "success": true | |
904 | } |
|
904 | } | |
905 | error: null |
|
905 | error: null | |
906 |
|
906 | |||
907 | delete_repo |
|
907 | delete_repo | |
908 | ^^^^^^^^^^^ |
|
908 | ^^^^^^^^^^^ | |
909 |
|
909 | |||
910 | Delete a repository. |
|
910 | Delete a repository. | |
911 | This command can only be executed using the api_key of a user with admin rights, |
|
911 | This command can only be executed using the api_key of a user with admin rights, | |
912 | or that of a regular user with admin access to the repository. |
|
912 | or that of a regular user with admin access to the repository. | |
913 | When ``forks`` param is set it is possible to detach or delete forks of the deleted repository. |
|
913 | When ``forks`` param is set it is possible to detach or delete forks of the deleted repository. | |
914 |
|
914 | |||
915 | INPUT:: |
|
915 | INPUT:: | |
916 |
|
916 | |||
917 | id : <id_for_response> |
|
917 | id : <id_for_response> | |
918 | api_key : "<api_key>" |
|
918 | api_key : "<api_key>" | |
919 | method : "delete_repo" |
|
919 | method : "delete_repo" | |
920 | args: { |
|
920 | args: { | |
921 | "repoid" : "<reponame or repo_id>", |
|
921 | "repoid" : "<reponame or repo_id>", | |
922 | "forks" : "`delete` or `detach` = Optional(None)" |
|
922 | "forks" : "`delete` or `detach` = Optional(None)" | |
923 | } |
|
923 | } | |
924 |
|
924 | |||
925 | OUTPUT:: |
|
925 | OUTPUT:: | |
926 |
|
926 | |||
927 | id : <id_given_in_input> |
|
927 | id : <id_given_in_input> | |
928 | result: { |
|
928 | result: { | |
929 | "msg": "Deleted repository `<reponame>`", |
|
929 | "msg": "Deleted repository `<reponame>`", | |
930 | "success": true |
|
930 | "success": true | |
931 | } |
|
931 | } | |
932 | error: null |
|
932 | error: null | |
933 |
|
933 | |||
934 | grant_user_permission |
|
934 | grant_user_permission | |
935 | ^^^^^^^^^^^^^^^^^^^^^ |
|
935 | ^^^^^^^^^^^^^^^^^^^^^ | |
936 |
|
936 | |||
937 | Grant permission for a user on the given repository, or update the existing one if found. |
|
937 | Grant permission for a user on the given repository, or update the existing one if found. | |
938 | This command can only be executed using the api_key of a user with admin rights. |
|
938 | This command can only be executed using the api_key of a user with admin rights. | |
939 |
|
939 | |||
940 | INPUT:: |
|
940 | INPUT:: | |
941 |
|
941 | |||
942 | id : <id_for_response> |
|
942 | id : <id_for_response> | |
943 | api_key : "<api_key>" |
|
943 | api_key : "<api_key>" | |
944 | method : "grant_user_permission" |
|
944 | method : "grant_user_permission" | |
945 | args: { |
|
945 | args: { | |
946 | "repoid" : "<reponame or repo_id>" |
|
946 | "repoid" : "<reponame or repo_id>" | |
947 | "userid" : "<username or user_id>" |
|
947 | "userid" : "<username or user_id>" | |
948 | "perm" : "(repository.(none|read|write|admin))", |
|
948 | "perm" : "(repository.(none|read|write|admin))", | |
949 | } |
|
949 | } | |
950 |
|
950 | |||
951 | OUTPUT:: |
|
951 | OUTPUT:: | |
952 |
|
952 | |||
953 | id : <id_given_in_input> |
|
953 | id : <id_given_in_input> | |
954 | result: { |
|
954 | result: { | |
955 | "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`", |
|
955 | "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`", | |
956 | "success": true |
|
956 | "success": true | |
957 | } |
|
957 | } | |
958 | error: null |
|
958 | error: null | |
959 |
|
959 | |||
960 | revoke_user_permission |
|
960 | revoke_user_permission | |
961 | ^^^^^^^^^^^^^^^^^^^^^^ |
|
961 | ^^^^^^^^^^^^^^^^^^^^^^ | |
962 |
|
962 | |||
963 | Revoke permission for a user on the given repository. |
|
963 | Revoke permission for a user on the given repository. | |
964 | This command can only be executed using the api_key of a user with admin rights. |
|
964 | This command can only be executed using the api_key of a user with admin rights. | |
965 |
|
965 | |||
966 | INPUT:: |
|
966 | INPUT:: | |
967 |
|
967 | |||
968 | id : <id_for_response> |
|
968 | id : <id_for_response> | |
969 | api_key : "<api_key>" |
|
969 | api_key : "<api_key>" | |
970 | method : "revoke_user_permission" |
|
970 | method : "revoke_user_permission" | |
971 | args: { |
|
971 | args: { | |
972 | "repoid" : "<reponame or repo_id>" |
|
972 | "repoid" : "<reponame or repo_id>" | |
973 | "userid" : "<username or user_id>" |
|
973 | "userid" : "<username or user_id>" | |
974 | } |
|
974 | } | |
975 |
|
975 | |||
976 | OUTPUT:: |
|
976 | OUTPUT:: | |
977 |
|
977 | |||
978 | id : <id_given_in_input> |
|
978 | id : <id_given_in_input> | |
979 | result: { |
|
979 | result: { | |
980 | "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`", |
|
980 | "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`", | |
981 | "success": true |
|
981 | "success": true | |
982 | } |
|
982 | } | |
983 | error: null |
|
983 | error: null | |
984 |
|
984 | |||
985 | grant_user_group_permission |
|
985 | grant_user_group_permission | |
986 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
986 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
987 |
|
987 | |||
988 | Grant permission for a user group on the given repository, or update the |
|
988 | Grant permission for a user group on the given repository, or update the | |
989 | existing one if found. |
|
989 | existing one if found. | |
990 | This command can only be executed using the api_key of a user with admin rights. |
|
990 | This command can only be executed using the api_key of a user with admin rights. | |
991 |
|
991 | |||
992 | INPUT:: |
|
992 | INPUT:: | |
993 |
|
993 | |||
994 | id : <id_for_response> |
|
994 | id : <id_for_response> | |
995 | api_key : "<api_key>" |
|
995 | api_key : "<api_key>" | |
996 | method : "grant_user_group_permission" |
|
996 | method : "grant_user_group_permission" | |
997 | args: { |
|
997 | args: { | |
998 | "repoid" : "<reponame or repo_id>" |
|
998 | "repoid" : "<reponame or repo_id>" | |
999 | "usersgroupid" : "<user group id or name>" |
|
999 | "usersgroupid" : "<user group id or name>" | |
1000 | "perm" : "(repository.(none|read|write|admin))", |
|
1000 | "perm" : "(repository.(none|read|write|admin))", | |
1001 | } |
|
1001 | } | |
1002 |
|
1002 | |||
1003 | OUTPUT:: |
|
1003 | OUTPUT:: | |
1004 |
|
1004 | |||
1005 | id : <id_given_in_input> |
|
1005 | id : <id_given_in_input> | |
1006 | result: { |
|
1006 | result: { | |
1007 | "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`", |
|
1007 | "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`", | |
1008 | "success": true |
|
1008 | "success": true | |
1009 | } |
|
1009 | } | |
1010 | error: null |
|
1010 | error: null | |
1011 |
|
1011 | |||
1012 | revoke_user_group_permission |
|
1012 | revoke_user_group_permission | |
1013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
1013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
1014 |
|
1014 | |||
1015 | Revoke permission for a user group on the given repository. |
|
1015 | Revoke permission for a user group on the given repository. | |
1016 | This command can only be executed using the api_key of a user with admin rights. |
|
1016 | This command can only be executed using the api_key of a user with admin rights. | |
1017 |
|
1017 | |||
1018 | INPUT:: |
|
1018 | INPUT:: | |
1019 |
|
1019 | |||
1020 | id : <id_for_response> |
|
1020 | id : <id_for_response> | |
1021 | api_key : "<api_key>" |
|
1021 | api_key : "<api_key>" | |
1022 | method : "revoke_user_group_permission" |
|
1022 | method : "revoke_user_group_permission" | |
1023 | args: { |
|
1023 | args: { | |
1024 | "repoid" : "<reponame or repo_id>" |
|
1024 | "repoid" : "<reponame or repo_id>" | |
1025 | "usersgroupid" : "<user group id or name>" |
|
1025 | "usersgroupid" : "<user group id or name>" | |
1026 | } |
|
1026 | } | |
1027 |
|
1027 | |||
1028 | OUTPUT:: |
|
1028 | OUTPUT:: | |
1029 |
|
1029 | |||
1030 | id : <id_given_in_input> |
|
1030 | id : <id_given_in_input> | |
1031 | result: { |
|
1031 | result: { | |
1032 | "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`", |
|
1032 | "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`", | |
1033 | "success": true |
|
1033 | "success": true | |
1034 | } |
|
1034 | } | |
1035 | error: null |
|
1035 | error: null | |
1036 |
|
1036 | |||
1037 | get_changesets |
|
1037 | get_changesets | |
1038 | ^^^^^^^^^^^^^^ |
|
1038 | ^^^^^^^^^^^^^^ | |
1039 |
|
1039 | |||
1040 | Get changesets of a given repository. This command can only be executed using the api_key |
|
1040 | Get changesets of a given repository. This command can only be executed using the api_key | |
1041 | of a user with read permissions to the repository. |
|
1041 | of a user with read permissions to the repository. | |
1042 |
|
1042 | |||
1043 | INPUT:: |
|
1043 | INPUT:: | |
1044 |
|
1044 | |||
1045 | id : <id_for_response> |
|
1045 | id : <id_for_response> | |
1046 | api_key : "<api_key>" |
|
1046 | api_key : "<api_key>" | |
1047 | method : "get_changesets" |
|
1047 | method : "get_changesets" | |
1048 | args: { |
|
1048 | args: { | |
1049 | "repoid" : "<reponame or repo_id>", |
|
1049 | "repoid" : "<reponame or repo_id>", | |
1050 | "start": "<revision number> = Optional(None)", |
|
1050 | "start": "<revision number> = Optional(None)", | |
1051 | "end": "<revision number> = Optional(None)", |
|
1051 | "end": "<revision number> = Optional(None)", | |
1052 | "start_date": "<date> = Optional(None)", # in "%Y-%m-%dT%H:%M:%S" format |
|
1052 | "start_date": "<date> = Optional(None)", # in "%Y-%m-%dT%H:%M:%S" format | |
1053 | "end_date": "<date> = Optional(None)", # in "%Y-%m-%dT%H:%M:%S" format |
|
1053 | "end_date": "<date> = Optional(None)", # in "%Y-%m-%dT%H:%M:%S" format | |
1054 | "branch_name": "<branch name filter> = Optional(None)", |
|
1054 | "branch_name": "<branch name filter> = Optional(None)", | |
1055 | "reverse": "<bool> = Optional(False)", |
|
1055 | "reverse": "<bool> = Optional(False)", | |
1056 | "with_file_list": "<bool> = Optional(False)" |
|
1056 | "with_file_list": "<bool> = Optional(False)" | |
1057 | } |
|
1057 | } | |
1058 |
|
1058 | |||
1059 | OUTPUT:: |
|
1059 | OUTPUT:: | |
1060 |
|
1060 | |||
1061 | id : <id_given_in_input> |
|
1061 | id : <id_given_in_input> | |
1062 | result: [ |
|
1062 | result: [ | |
1063 | { |
|
1063 | { | |
1064 | "raw_id": "<raw_id>", |
|
1064 | "raw_id": "<raw_id>", | |
1065 | "short_id": "short_id": "<short_id>", |
|
1065 | "short_id": "short_id": "<short_id>", | |
1066 | "author": "<full_author>", |
|
1066 | "author": "<full_author>", | |
1067 | "date": "<date_time_of_commit>", |
|
1067 | "date": "<date_time_of_commit>", | |
1068 | "message": "<commit_message>", |
|
1068 | "message": "<commit_message>", | |
1069 | "revision": "<numeric_revision>", |
|
1069 | "revision": "<numeric_revision>", | |
1070 | <if with_file_list == True> |
|
1070 | <if with_file_list == True> | |
1071 | "added": [<list of added files>], |
|
1071 | "added": [<list of added files>], | |
1072 | "changed": [<list of changed files>], |
|
1072 | "changed": [<list of changed files>], | |
1073 | "removed": [<list of removed files>] |
|
1073 | "removed": [<list of removed files>] | |
1074 | }, |
|
1074 | }, | |
1075 | ... |
|
1075 | ... | |
1076 | ] |
|
1076 | ] | |
1077 | error: null |
|
1077 | error: null | |
1078 |
|
1078 | |||
1079 | get_changeset |
|
1079 | get_changeset | |
1080 | ^^^^^^^^^^^^^ |
|
1080 | ^^^^^^^^^^^^^ | |
1081 |
|
1081 | |||
1082 | Get information and review status for a given changeset. This command can only |
|
1082 | Get information and review status for a given changeset. This command can only | |
1083 | be executed using the api_key of a user with read permissions to the |
|
1083 | be executed using the api_key of a user with read permissions to the | |
1084 | repository. |
|
1084 | repository. | |
1085 |
|
1085 | |||
1086 | INPUT:: |
|
1086 | INPUT:: | |
1087 |
|
1087 | |||
1088 | id : <id_for_response> |
|
1088 | id : <id_for_response> | |
1089 | api_key : "<api_key>" |
|
1089 | api_key : "<api_key>" | |
1090 | method : "get_changeset" |
|
1090 | method : "get_changeset" | |
1091 | args: { |
|
1091 | args: { | |
1092 | "repoid" : "<reponame or repo_id>", |
|
1092 | "repoid" : "<reponame or repo_id>", | |
1093 | "raw_id" : "<raw_id>", |
|
1093 | "raw_id" : "<raw_id>", | |
1094 | "with_reviews": "<bool> = Optional(False)" |
|
1094 | "with_reviews": "<bool> = Optional(False)" | |
1095 | } |
|
1095 | } | |
1096 |
|
1096 | |||
1097 | OUTPUT:: |
|
1097 | OUTPUT:: | |
1098 |
|
1098 | |||
1099 | id : <id_given_in_input> |
|
1099 | id : <id_given_in_input> | |
1100 | result: { |
|
1100 | result: { | |
1101 | "author": "<full_author>", |
|
1101 | "author": "<full_author>", | |
1102 | "date": "<date_time_of_commit>", |
|
1102 | "date": "<date_time_of_commit>", | |
1103 | "message": "<commit_message>", |
|
1103 | "message": "<commit_message>", | |
1104 | "raw_id": "<raw_id>", |
|
1104 | "raw_id": "<raw_id>", | |
1105 | "revision": "<numeric_revision>", |
|
1105 | "revision": "<numeric_revision>", | |
1106 | "short_id": "<short_id>", |
|
1106 | "short_id": "<short_id>", | |
1107 | "reviews": [{ |
|
1107 | "reviews": [{ | |
1108 | "reviewer": "<username>", |
|
1108 | "reviewer": "<username>", | |
1109 | "modified_at": "<date_time_of_review>", # iso 8601 date, server's timezone |
|
1109 | "modified_at": "<date_time_of_review>", # iso 8601 date, server's timezone | |
1110 | "status": "<status_of_review>", # "under_review", "approved" or "rejected" |
|
1110 | "status": "<status_of_review>", # "under_review", "approved" or "rejected" | |
1111 | }, |
|
1111 | }, | |
1112 | ... |
|
1112 | ... | |
1113 | ] |
|
1113 | ] | |
1114 | } |
|
1114 | } | |
1115 | error: null |
|
1115 | error: null | |
1116 |
|
1116 | |||
1117 | Example output:: |
|
1117 | Example output:: | |
1118 |
|
1118 | |||
1119 | { |
|
1119 | { | |
1120 | "id" : 1, |
|
1120 | "id" : 1, | |
1121 | "error" : null, |
|
1121 | "error" : null, | |
1122 | "result" : { |
|
1122 | "result" : { | |
1123 | "author" : { |
|
1123 | "author" : { | |
1124 | "email" : "user@example.com", |
|
1124 | "email" : "user@example.com", | |
1125 | "name" : "Kallithea Admin" |
|
1125 | "name" : "Kallithea Admin" | |
1126 | }, |
|
1126 | }, | |
1127 | "changed" : [], |
|
1127 | "changed" : [], | |
1128 | "short_id" : "e1022d3d28df", |
|
1128 | "short_id" : "e1022d3d28df", | |
1129 | "date" : "2017-03-28T09:09:03", |
|
1129 | "date" : "2017-03-28T09:09:03", | |
1130 | "added" : [ |
|
1130 | "added" : [ | |
1131 | "README.rst" |
|
1131 | "README.rst" | |
1132 | ], |
|
1132 | ], | |
1133 | "removed" : [], |
|
1133 | "removed" : [], | |
1134 | "revision" : 0, |
|
1134 | "revision" : 0, | |
1135 | "raw_id" : "e1022d3d28dfba02f626cde65dbe08f4ceb0e4e7", |
|
1135 | "raw_id" : "e1022d3d28dfba02f626cde65dbe08f4ceb0e4e7", | |
1136 | "message" : "Added file via Kallithea", |
|
1136 | "message" : "Added file via Kallithea", | |
1137 | "id" : "e1022d3d28dfba02f626cde65dbe08f4ceb0e4e7", |
|
1137 | "id" : "e1022d3d28dfba02f626cde65dbe08f4ceb0e4e7", | |
1138 | "reviews" : [ |
|
1138 | "reviews" : [ | |
1139 | { |
|
1139 | { | |
1140 | "status" : "under_review", |
|
1140 | "status" : "under_review", | |
1141 | "modified_at" : "2017-03-28T09:17:08.618", |
|
1141 | "modified_at" : "2017-03-28T09:17:08.618", | |
1142 | "reviewer" : "user" |
|
1142 | "reviewer" : "user" | |
1143 | } |
|
1143 | } | |
1144 | ] |
|
1144 | ] | |
1145 | } |
|
1145 | } | |
1146 | } |
|
1146 | } | |
1147 |
|
1147 | |||
1148 | get_pullrequest |
|
1148 | get_pullrequest | |
1149 | ^^^^^^^^^^^^^^^ |
|
1149 | ^^^^^^^^^^^^^^^ | |
1150 |
|
1150 | |||
1151 | Get information and review status for a given pull request. This command can only be executed |
|
1151 | Get information and review status for a given pull request. This command can only be executed | |
1152 | using the api_key of a user with read permissions to the original repository. |
|
1152 | using the api_key of a user with read permissions to the original repository. | |
1153 |
|
1153 | |||
1154 | INPUT:: |
|
1154 | INPUT:: | |
1155 |
|
1155 | |||
1156 | id : <id_for_response> |
|
1156 | id : <id_for_response> | |
1157 | api_key : "<api_key>" |
|
1157 | api_key : "<api_key>" | |
1158 | method : "get_pullrequest" |
|
1158 | method : "get_pullrequest" | |
1159 | args: { |
|
1159 | args: { | |
1160 | "pullrequest_id" : "<pullrequest_id>", |
|
1160 | "pullrequest_id" : "<pullrequest_id>", | |
1161 | } |
|
1161 | } | |
1162 |
|
1162 | |||
1163 | OUTPUT:: |
|
1163 | OUTPUT:: | |
1164 |
|
1164 | |||
1165 | id : <id_given_in_input> |
|
1165 | id : <id_given_in_input> | |
1166 | result: { |
|
1166 | result: { | |
1167 | "status": "<pull_request_status>", |
|
1167 | "status": "<pull_request_status>", | |
1168 | "pull_request_id": <pull_request_id>, |
|
1168 | "pull_request_id": <pull_request_id>, | |
1169 | "description": "<pull_request_description>", |
|
1169 | "description": "<pull_request_description>", | |
1170 | "title": "<pull_request_title>", |
|
1170 | "title": "<pull_request_title>", | |
1171 | "url": "<pull_request_url>", |
|
1171 | "url": "<pull_request_url>", | |
1172 | "reviewers": [ |
|
1172 | "reviewers": [ | |
1173 | { |
|
1173 | { | |
1174 | "username": "<user_name>", |
|
1174 | "username": "<user_name>", | |
1175 | }, |
|
1175 | }, | |
1176 | ... |
|
1176 | ... | |
1177 | ], |
|
1177 | ], | |
1178 | "org_repo_url": "<repo_url>", |
|
1178 | "org_repo_url": "<repo_url>", | |
1179 | "org_ref_parts": [ |
|
1179 | "org_ref_parts": [ | |
1180 | "<ref_type>", |
|
1180 | "<ref_type>", | |
1181 | "<ref_name>", |
|
1181 | "<ref_name>", | |
1182 | "<raw_id>" |
|
1182 | "<raw_id>" | |
1183 | ], |
|
1183 | ], | |
1184 | "other_ref_parts": [ |
|
1184 | "other_ref_parts": [ | |
1185 | "<ref_type>", |
|
1185 | "<ref_type>", | |
1186 | "<ref_name>", |
|
1186 | "<ref_name>", | |
1187 | "<raw_id>" |
|
1187 | "<raw_id>" | |
1188 | ], |
|
1188 | ], | |
1189 | "comments": [ |
|
1189 | "comments": [ | |
1190 | { |
|
1190 | { | |
1191 | "username": "<user_name>", |
|
1191 | "username": "<user_name>", | |
1192 | "text": "<comment text>", |
|
1192 | "text": "<comment text>", | |
1193 | "comment_id": "<comment_id>", |
|
1193 | "comment_id": "<comment_id>", | |
1194 | }, |
|
1194 | }, | |
1195 | ... |
|
1195 | ... | |
1196 | ], |
|
1196 | ], | |
1197 | "owner": "<username>", |
|
1197 | "owner": "<username>", | |
1198 | "statuses": [ |
|
1198 | "statuses": [ | |
1199 | { |
|
1199 | { | |
1200 | "status": "<status_of_review>", # "under_review", "approved" or "rejected" |
|
1200 | "status": "<status_of_review>", # "under_review", "approved" or "rejected" | |
1201 | "reviewer": "<user_name>", |
|
1201 | "reviewer": "<user_name>", | |
1202 | "modified_at": "<date_time_of_review>" # iso 8601 date, server's timezone |
|
1202 | "modified_at": "<date_time_of_review>" # iso 8601 date, server's timezone | |
1203 | }, |
|
1203 | }, | |
1204 | ... |
|
1204 | ... | |
1205 | ], |
|
1205 | ], | |
1206 | "revisions": [ |
|
1206 | "revisions": [ | |
1207 | "<raw_id>", |
|
1207 | "<raw_id>", | |
1208 | ... |
|
1208 | ... | |
1209 | ] |
|
1209 | ] | |
1210 | }, |
|
1210 | }, | |
1211 | error: null |
|
1211 | error: null | |
1212 |
|
1212 | |||
1213 | comment_pullrequest |
|
1213 | comment_pullrequest | |
1214 | ^^^^^^^^^^^^^^^^^^^ |
|
1214 | ^^^^^^^^^^^^^^^^^^^ | |
1215 |
|
1215 | |||
1216 | Add comment, change status or close a given pull request. This command can only be executed |
|
1216 | Add comment, change status or close a given pull request. This command can only be executed | |
1217 | using the api_key of a user with read permissions to the original repository. |
|
1217 | using the api_key of a user with read permissions to the original repository. | |
1218 |
|
1218 | |||
1219 | INPUT:: |
|
1219 | INPUT:: | |
1220 |
|
1220 | |||
1221 | id : <id_for_response> |
|
1221 | id : <id_for_response> | |
1222 | api_key : "<api_key>" |
|
1222 | api_key : "<api_key>" | |
1223 | method : "comment_pullrequest" |
|
1223 | method : "comment_pullrequest" | |
1224 | args: { |
|
1224 | args: { | |
1225 | "pull_request_id": "<pull_request_id>", |
|
1225 | "pull_request_id": "<pull_request_id>", | |
1226 | "comment_msg": Optional(''), |
|
1226 | "comment_msg": Optional(''), | |
1227 | "status": Optional(None), # "under_review", "approved" or "rejected" |
|
1227 | "status": Optional(None), # "under_review", "approved" or "rejected" | |
1228 | "close_pr": Optional(False)", |
|
1228 | "close_pr": Optional(False)", | |
1229 | } |
|
1229 | } | |
1230 |
|
1230 | |||
1231 | OUTPUT:: |
|
1231 | OUTPUT:: | |
1232 |
|
1232 | |||
1233 | id : <id_given_in_input> |
|
1233 | id : <id_given_in_input> | |
1234 | result: True |
|
1234 | result: True | |
1235 | error: null |
|
1235 | error: null | |
1236 |
|
1236 | |||
1237 |
|
1237 | |||
1238 | API access for web views |
|
1238 | API access for web views | |
1239 | ------------------------ |
|
1239 | ------------------------ | |
1240 |
|
1240 | |||
1241 | Kallithea HTTP entry points can also be accessed without login using bearer |
|
1241 | Kallithea HTTP entry points can also be accessed without login using bearer | |
1242 | authentication by including this header with the request:: |
|
1242 | authentication by including this header with the request:: | |
1243 |
|
1243 | |||
1244 | Authentication: Bearer <api_key> |
|
1244 | Authentication: Bearer <api_key> | |
1245 |
|
1245 | |||
1246 | Alternatively, the API key can be passed in the URL query string using |
|
1246 | Alternatively, the API key can be passed in the URL query string using | |
1247 | ``?api_key=<api_key>``, though this is not recommended due to the increased |
|
1247 | ``?api_key=<api_key>``, though this is not recommended due to the increased | |
1248 | risk of API key leaks, and support will likely be removed in the future. |
|
1248 | risk of API key leaks, and support will likely be removed in the future. | |
1249 |
|
1249 | |||
1250 | Exposing raw diffs is a good way to integrate with |
|
1250 | Exposing raw diffs is a good way to integrate with | |
1251 | third-party services like code review, or build farms that can download archives. |
|
1251 | 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