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