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