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