blob: 3ba30c33fde152791258c51f31ba828ed54dfba4 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - /groups/ REST API
Edwin Kempind0a63922013-01-23 16:32:59 +01002
3This page describes the group related REST endpoints.
4Please also take note of the general information on the
5link:rest-api.html[REST API].
6
Edwin Kempin578fff72013-02-11 08:08:27 +01007[[group-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008== Group Endpoints
Edwin Kempind0a63922013-01-23 16:32:59 +01009
Edwin Kempin76202742013-02-15 13:51:50 +010010[[list-groups]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080011=== List Groups
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080012--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010013'GET /groups/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080014--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010015
Edwin Kempind0a63922013-01-23 16:32:59 +010016Lists the groups accessible by the caller. This is the same as
17using the link:cmd-ls-groups.html[ls-groups] command over SSH,
18and accepts the same options as query parameters.
19
Edwin Kempin987d5432013-02-04 10:20:44 +010020As result a map is returned that maps the group names to
21link:#group-info[GroupInfo] entries. The entries in the map are sorted
22by group name.
23
Edwin Kempin37440832013-02-06 11:36:00 +010024.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010025----
26 GET /groups/ HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010027----
Edwin Kempind0a63922013-01-23 16:32:59 +010028
Edwin Kempin37440832013-02-06 11:36:00 +010029.Response
30----
Edwin Kempind0a63922013-01-23 16:32:59 +010031 HTTP/1.1 200 OK
32 Content-Disposition: attachment
33 Content-Type: application/json;charset=UTF-8
34
35 )]}'
36 {
37 "Administrators": {
38 "kind": "gerritcodereview#group",
39 "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
Edwin Kempine05c9642013-02-11 09:36:21 +010040 "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
41 "options": {
Edwin Kempine05c9642013-02-11 09:36:21 +010042 },
Edwin Kempind0a63922013-01-23 16:32:59 +010043 "description": "Gerrit Site Administrators",
44 "group_id": 1,
Edwin Kempinc6993fb2013-02-11 12:39:13 +010045 "owner": "Administrators",
Edwin Kempind0a63922013-01-23 16:32:59 +010046 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
47 },
48 "Anonymous Users": {
49 "kind": "gerritcodereview#group",
50 "id": "global%3AAnonymous-Users",
Edwin Kempine05c9642013-02-11 09:36:21 +010051 "url": "#/admin/groups/uuid-global%3AAnonymous-Users",
52 "options": {
Edwin Kempine05c9642013-02-11 09:36:21 +010053 },
Edwin Kempind0a63922013-01-23 16:32:59 +010054 "description": "Any user, signed-in or not",
55 "group_id": 2,
Edwin Kempinc6993fb2013-02-11 12:39:13 +010056 "owner": "Administrators",
Edwin Kempind0a63922013-01-23 16:32:59 +010057 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
58 },
59 "MyProject_Committers": {
60 "kind": "gerritcodereview#group",
61 "id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7",
Edwin Kempine05c9642013-02-11 09:36:21 +010062 "url": "#/admin/groups/uuid-834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7",
63 "options": {
Edwin Kempine05c9642013-02-11 09:36:21 +010064 "visible_to_all": true,
65 },
Edwin Kempind0a63922013-01-23 16:32:59 +010066 "group_id": 6,
Edwin Kempinc6993fb2013-02-11 12:39:13 +010067 "owner": "MyProject_Committers",
Edwin Kempind0a63922013-01-23 16:32:59 +010068 "owner_id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7"
69 },
70 "Non-Interactive Users": {
71 "kind": "gerritcodereview#group",
72 "id": "5057f3cbd3519d6ab69364429a89ffdffba50f73",
Edwin Kempine05c9642013-02-11 09:36:21 +010073 "url": "#/admin/groups/uuid-5057f3cbd3519d6ab69364429a89ffdffba50f73",
74 "options": {
Edwin Kempine05c9642013-02-11 09:36:21 +010075 },
Edwin Kempind0a63922013-01-23 16:32:59 +010076 "description": "Users who perform batch actions on Gerrit",
77 "group_id": 4,
Edwin Kempinc6993fb2013-02-11 12:39:13 +010078 "owner": "Administrators",
Edwin Kempind0a63922013-01-23 16:32:59 +010079 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
80 },
81 "Project Owners": {
82 "kind": "gerritcodereview#group",
83 "id": "global%3AProject-Owners",
Edwin Kempine05c9642013-02-11 09:36:21 +010084 "url": "#/admin/groups/uuid-global%3AProject-Owners",
85 "options": {
Edwin Kempine05c9642013-02-11 09:36:21 +010086 },
Edwin Kempind0a63922013-01-23 16:32:59 +010087 "description": "Any owner of the project",
88 "group_id": 5,
Edwin Kempinc6993fb2013-02-11 12:39:13 +010089 "owner": "Administrators",
Edwin Kempind0a63922013-01-23 16:32:59 +010090 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
91 },
92 "Registered Users": {
93 "kind": "gerritcodereview#group",
94 "id": "global%3ARegistered-Users",
Edwin Kempine05c9642013-02-11 09:36:21 +010095 "url": "#/admin/groups/uuid-global%3ARegistered-Users",
96 "options": {
Edwin Kempine05c9642013-02-11 09:36:21 +010097 },
Edwin Kempind0a63922013-01-23 16:32:59 +010098 "description": "Any signed-in user",
99 "group_id": 3,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100100 "owner": "Administrators",
Edwin Kempind0a63922013-01-23 16:32:59 +0100101 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
102 }
103 }
104----
105
Edwin Kempina64c4b92013-01-23 11:30:40 +0100106.Get all groups
107****
108get::/groups/
109****
110
Edwin Kempinabaab5462013-02-11 15:30:19 +0100111[[group-options]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800112==== Group Options
Edwin Kempinabaab5462013-02-11 15:30:19 +0100113Additional fields can be obtained by adding `o` parameters, each option
114requires more lookups and slows down the query response time to the
115client so they are generally disabled by default. Optional fields are:
116
117[[includes]]
118--
119* `INCLUDES`: include list of directly included groups.
120--
121
122[[members]]
123--
124* `MEMBERS`: include list of direct group members.
125--
126
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800127==== Check if a group is owned by the calling user
Edwin Kempina3b4b632013-02-11 10:33:55 +0100128By setting the option `owned` and specifying a group to inspect with
129the option `q`, it is possible to find out, if this group is owned by
130the calling user.
131
132.Request
133----
134 GET /groups/?owned&q=MyProject-Committers HTTP/1.0
135----
136
137If the group is owned by the calling user, the returned map contains
138this group. If the calling user doesn't own this group an empty map is
139returned.
140
141.Response
142----
143 HTTP/1.1 200 OK
144 Content-Disposition: attachment
145 Content-Type: application/json;charset=UTF-8
146
147 )]}'
148 {
149 "MyProject-Committers": {
150 "kind": "gerritcodereview#group",
151 "id": "9999c971bb4ab872aab759d8c49833ee6b9ff320",
Edwin Kempina3b4b632013-02-11 10:33:55 +0100152 "url": "#/admin/groups/uuid-9999c971bb4ab872aab759d8c49833ee6b9ff320",
153 "options": {
Edwin Kempina3b4b632013-02-11 10:33:55 +0100154 "visible_to_all": true
155 },
156 "description":"contains all committers for MyProject",
157 "group_id": 551,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100158 "owner": "MyProject-Owners",
Edwin Kempina3b4b632013-02-11 10:33:55 +0100159 "owner_id": "7ca042f4d5847936fcb90ca91057673157fd06fc"
160 }
161 }
162----
163
Edwin Kempina5cc1122013-02-11 09:26:20 +0100164[[get-group]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800165=== Get Group
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800166--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100167'GET /groups/link:#group-id[\{group-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800168--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100169
Edwin Kempina5cc1122013-02-11 09:26:20 +0100170Retrieves a group.
171
172.Request
173----
174 GET /groups/6a1e70e1a88782771a91808c8af9bbb7a9871389 HTTP/1.0
175----
176
177As response a link:#group-info[GroupInfo] entity is returned that
178describes the group.
179
180.Response
181----
182 HTTP/1.1 200 OK
183 Content-Disposition: attachment
184 Content-Type: application/json;charset=UTF-8
185
186 )]}'
187 {
188 "kind": "gerritcodereview#group",
189 "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
190 "name": "Administrators",
191 "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
192 "options": {
Edwin Kempina5cc1122013-02-11 09:26:20 +0100193 },
194 "description": "Gerrit Site Administrators",
195 "group_id": 1,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100196 "owner": "Administrators",
Edwin Kempina5cc1122013-02-11 09:26:20 +0100197 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
198 }
199----
200
Edwin Kempin578fff72013-02-11 08:08:27 +0100201[[create-group]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800202=== Create Group
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800203--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100204'PUT /groups/link:#group-name[\{group-name\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800205--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100206
Edwin Kempin578fff72013-02-11 08:08:27 +0100207Creates a new Gerrit internal group.
208
209In the request body additional data for the group can be provided as
210link:#group-input[GroupInput].
211
212.Request
213----
214 PUT /groups/MyProject-Committers HTTP/1.0
215 Content-Type: application/json;charset=UTF-8
216
217 {
218 "description": "contains all committers for MyProject",
219 "visible_to_all": true,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100220 "owner": "MyProject-Owners",
Edwin Kempin578fff72013-02-11 08:08:27 +0100221 "owner_id": "7ca042f4d5847936fcb90ca91057673157fd06fc"
222 }
223----
224
225As response the link:#group-info[GroupInfo] entity is returned that
226describes the created group.
227
228.Response
229----
230 HTTP/1.1 201 Created
231 Content-Disposition: attachment
232 Content-Type: application/json;charset=UTF-8
233
234 )]}'
235 {
236 "kind": "gerritcodereview#group",
237 "id": "9999c971bb4ab872aab759d8c49833ee6b9ff320",
238 "name": "MyProject-Committers",
239 "url": "#/admin/groups/uuid-9999c971bb4ab872aab759d8c49833ee6b9ff320",
240 "options": {
Edwin Kempin578fff72013-02-11 08:08:27 +0100241 "visible_to_all": true
242 },
243 "description":"contains all committers for MyProject",
244 "group_id": 551,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100245 "owner": "MyProject-Owners",
Edwin Kempin578fff72013-02-11 08:08:27 +0100246 "owner_id": "7ca042f4d5847936fcb90ca91057673157fd06fc"
247 }
248----
249
Edwin Kempin0aa27102013-02-27 16:44:16 +0100250If the group creation fails because the name is already in use the
251response is "`409 Conflict`".
252
Edwin Kempinabaab5462013-02-11 15:30:19 +0100253[[get-group-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800254=== Get Group Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800255--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100256'GET /groups/link:#group-id[\{group-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800257--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100258
Edwin Kempinabaab5462013-02-11 15:30:19 +0100259Retrieves a group with the direct link:#members[members] and the
260directly link:#includes[included groups].
261
262.Request
263----
264 GET /groups/6a1e70e1a88782771a91808c8af9bbb7a9871389/detail HTTP/1.0
265----
266
267As response a link:#group-info[GroupInfo] entity is returned that
268describes the group.
269
270.Response
271----
272 HTTP/1.1 200 OK
273 Content-Disposition: attachment
274 Content-Type: application/json;charset=UTF-8
275
276 )]}'
277 {
278 "kind": "gerritcodereview#group",
279 "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
280 "name": "Administrators",
281 "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
282 "options": {
283 },
284 "description": "Gerrit Site Administrators",
285 "group_id": 1,
286 "owner": "Administrators",
287 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
288 "members": [
289 {
Edwin Kempin51284e62013-03-05 15:26:41 +0100290 "_account_id": 1000097,
291 "name": "Jane Roe",
James Ring8e342722013-05-01 01:40:53 -0700292 "email": "jane.roe@example.com",
293 "username": "jane"
Edwin Kempinabaab5462013-02-11 15:30:19 +0100294 },
295 {
Edwin Kempin51284e62013-03-05 15:26:41 +0100296 "_account_id": 1000096,
297 "name": "John Doe",
298 "email": "john.doe@example.com"
James Ring8e342722013-05-01 01:40:53 -0700299 "username": "john"
Edwin Kempinabaab5462013-02-11 15:30:19 +0100300 }
301 ],
302 "includes": []
303 }
304----
305
Edwin Kempin1461c222013-02-11 08:41:08 +0100306[[get-group-name]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800307=== Get Group Name
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800308--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100309'GET /groups/link:#group-id[\{group-id\}]/name'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800310--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100311
Edwin Kempin1461c222013-02-11 08:41:08 +0100312Retrieves the name of a group.
313
314.Request
315----
316 GET /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/name HTTP/1.0
317----
318
319.Response
320----
321 HTTP/1.1 200 OK
322 Content-Disposition: attachment
323 Content-Type: application/json;charset=UTF-8
324
325 )]}'
326 "MyProject-Committers"
327----
328
329[[rename-group]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800330=== Rename Group
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800331--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100332'PUT /groups/link:#group-id[\{group-id\}]/name'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800333--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100334
Edwin Kempin1461c222013-02-11 08:41:08 +0100335Renames a Gerrit internal group.
336
337The new group name must be provided in the request body.
338
339.Request
340----
341 PUT /groups/MyProject-Committers/name HTTP/1.0
342 Content-Type: application/json;charset=UTF-8
343
344 {
345 "name": "My-Project-Committers"
346 }
347----
348
349As response the new group name is returned.
350
351.Response
352----
353 HTTP/1.1 200 OK
354 Content-Disposition: attachment
355 Content-Type: application/json;charset=UTF-8
356
357 )]}'
358 "My-Project-Committers"
359----
360
Edwin Kempin0aa27102013-02-27 16:44:16 +0100361If renaming the group fails because the new name is already in use the
362response is "`409 Conflict`".
363
Edwin Kempin1461c222013-02-11 08:41:08 +0100364[[get-group-description]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800365=== Get Group Description
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800366--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100367'GET /groups/link:#group-id[\{group-id\}]/description'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800368--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100369
Edwin Kempin1461c222013-02-11 08:41:08 +0100370Retrieves the description of a group.
371
372.Request
373----
374 GET /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/description HTTP/1.0
375----
376
377.Response
378----
379 HTTP/1.1 200 OK
380 Content-Disposition: attachment
381 Content-Type: application/json;charset=UTF-8
382
383 )]}'
384 "contains all committers for MyProject"
385----
386
Edwin Kempinefec4492013-02-22 10:09:23 +0100387If the group does not have a description an empty string is returned.
388
Edwin Kempin1461c222013-02-11 08:41:08 +0100389[[set-group-description]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800390=== Set Group Description
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800391--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100392'PUT /groups/link:#group-id[\{group-id\}]/description'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800393--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100394
Edwin Kempin1461c222013-02-11 08:41:08 +0100395Sets the description of a Gerrit internal group.
396
397The new group description must be provided in the request body.
398
399.Request
400----
401 PUT /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/description HTTP/1.0
402 Content-Type: application/json;charset=UTF-8
403
404 {
405 "description": "The committers of MyProject."
406 }
407----
408
409As response the new group description is returned.
410
411.Response
412----
413 HTTP/1.1 200 OK
414 Content-Disposition: attachment
415 Content-Type: application/json;charset=UTF-8
416
417 )]}'
418 "The committers of MyProject."
419----
420
Edwin Kempin114ab162013-02-28 09:25:37 +0100421If the description was deleted the response is "`204 No Content`".
422
Edwin Kempin1461c222013-02-11 08:41:08 +0100423[[delete-group-description]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800424=== Delete Group Description
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800425--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100426'DELETE /groups/link:#group-id[\{group-id\}]/description'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800427--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100428
Edwin Kempin1461c222013-02-11 08:41:08 +0100429Deletes the description of a Gerrit internal group.
430
431.Request
432----
433 DELETE /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/description HTTP/1.0
434----
435
436.Response
437----
438 HTTP/1.1 204 No Content
439----
440
441[[get-group-options]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800442=== Get Group Options
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800443--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100444'GET /groups/link:#group-id[\{group-id\}]/options'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800445--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100446
Edwin Kempin1461c222013-02-11 08:41:08 +0100447Retrieves the options of a group.
448
449.Request
450----
451 GET /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/options HTTP/1.0
452----
453
454As response a link:#group-options-info[GroupOptionsInfo] entity is
455returned that describes the options of the group.
456
457.Response
458----
459 HTTP/1.1 200 OK
460 Content-Disposition: attachment
461 Content-Type: application/json;charset=UTF-8
462
463 )]}'
464 {
Edwin Kempin1461c222013-02-11 08:41:08 +0100465 "visible_to_all": true
466 }
467----
468
469[[set-group-options]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800470=== Set Group Options
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800471--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100472'PUT /groups/link:#group-id[\{group-id\}]/options'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800473--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100474
Edwin Kempin1461c222013-02-11 08:41:08 +0100475Sets the options of a Gerrit internal group.
476
477The new group options must be provided in the request body as a
478link:#group-options-input[GroupOptionsInput] entity.
479
480.Request
481----
482 PUT /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/options HTTP/1.0
483 Content-Type: application/json;charset=UTF-8
484
485 {
486 "visible_to_all": true
487 }
488----
489
490As response the new group options are returned as a
491link:#group-options-info[GroupOptionsInfo] entity.
492
493.Response
494----
495 HTTP/1.1 200 OK
496 Content-Disposition: attachment
497 Content-Type: application/json;charset=UTF-8
498
499 )]}'
500 {
Edwin Kempin1461c222013-02-11 08:41:08 +0100501 "visible_to_all": true
502 }
503----
504
505[[get-group-owner]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800506=== Get Group Owner
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800507--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100508'GET /groups/link:#group-id[\{group-id\}]/owner'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800509--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100510
Edwin Kempin1461c222013-02-11 08:41:08 +0100511Retrieves the owner group of a Gerrit internal group.
512
513.Request
514----
515 GET /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/owner HTTP/1.0
516----
517
518As response a link:#group-info[GroupInfo] entity is returned that
519describes the owner group.
520
521.Response
522----
523 HTTP/1.1 200 OK
524 Content-Disposition: attachment
525 Content-Type: application/json;charset=UTF-8
526
527 )]}'
528 {
529 "kind": "gerritcodereview#group",
530 "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
531 "name": "Administrators",
532 "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
533 "options": {
Edwin Kempin1461c222013-02-11 08:41:08 +0100534 },
535 "description": "Gerrit Site Administrators",
536 "group_id": 1,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100537 "owner": "Administrators",
Edwin Kempin1461c222013-02-11 08:41:08 +0100538 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
539 }
540----
541
542[[set-group-owner]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800543=== Set Group Owner
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800544--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100545'PUT /groups/link:#group-id[\{group-id\}]/owner'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800546--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100547
Edwin Kempin1461c222013-02-11 08:41:08 +0100548Sets the owner group of a Gerrit internal group.
549
550The new owner group must be provided in the request body.
551
Edwin Kempinc9770902013-02-15 15:38:03 +0100552The new owner can be specified by name, by group UUID or by the legacy
553numeric group ID.
554
Edwin Kempin1461c222013-02-11 08:41:08 +0100555.Request
556----
557 PUT /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/description HTTP/1.0
558 Content-Type: application/json;charset=UTF-8
559
560 {
561 "owner": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
562 }
563----
564
565As response a link:#group-info[GroupInfo] entity is returned that
566describes the new owner group.
567
568.Response
569----
570 HTTP/1.1 200 OK
571 Content-Disposition: attachment
572 Content-Type: application/json;charset=UTF-8
573
574 )]}'
575 {
576 "kind": "gerritcodereview#group",
577 "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
578 "name": "Administrators",
579 "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
580 "options": {
Edwin Kempin1461c222013-02-11 08:41:08 +0100581 },
582 "description": "Gerrit Site Administrators",
583 "group_id": 1,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100584 "owner": "Administrators",
Edwin Kempin1461c222013-02-11 08:41:08 +0100585 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
586 }
587----
588
Edwin Kempin578fff72013-02-11 08:08:27 +0100589[[group-member-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800590== Group Member Endpoints
Edwin Kempin578fff72013-02-11 08:08:27 +0100591
Edwin Kempind0a63922013-01-23 16:32:59 +0100592[[group-members]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800593=== List Group Members
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800594--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100595'GET /groups/link:#group-id[\{group-id\}]/members/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800596--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100597
Edwin Kempin2dc5edc2013-02-11 15:57:36 +0100598Lists the direct members of a Gerrit internal group.
Edwin Kempind0a63922013-01-23 16:32:59 +0100599
Edwin Kempin963dfd02013-02-27 12:39:32 +0100600As result a list of detailed link:rest-api-accounts.html#account-info[
601AccountInfo] entries is returned. The entries in the list are sorted by
602full name, preferred email and id.
Edwin Kempin4156d6e02013-02-04 15:10:39 +0100603
Edwin Kempin37440832013-02-06 11:36:00 +0100604.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100605----
606 GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/members/ HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100607----
Edwin Kempind0a63922013-01-23 16:32:59 +0100608
Edwin Kempin37440832013-02-06 11:36:00 +0100609.Response
610----
Edwin Kempind0a63922013-01-23 16:32:59 +0100611 HTTP/1.1 200 OK
612 Content-Disposition: attachment
613 Content-Type: application/json;charset=UTF-8
614
615 )]}'
616 [
617 {
Edwin Kempin963dfd02013-02-27 12:39:32 +0100618 "_account_id": 1000097,
619 "name": "Jane Roe",
James Ring8e342722013-05-01 01:40:53 -0700620 "email": "jane.roe@example.com",
621 "username": "jane"
Edwin Kempind0a63922013-01-23 16:32:59 +0100622 },
623 {
Edwin Kempin963dfd02013-02-27 12:39:32 +0100624 "_account_id": 1000096,
625 "name": "John Doe",
James Ring8e342722013-05-01 01:40:53 -0700626 "email": "john.doe@example.com",
627 "username": "john"
Edwin Kempind0a63922013-01-23 16:32:59 +0100628 }
629 ]
630----
631
Edwin Kempina64c4b92013-01-23 11:30:40 +0100632.Get all members of the 'Administrators' group (normally group id = 1)
633****
634get::/groups/1/members/
635****
636
Edwin Kempind0a63922013-01-23 16:32:59 +0100637To resolve the included groups of a group recursively and to list all
638members the parameter `recursive` can be set.
639
Edwin Kempind54de1c2013-03-08 16:37:14 +0100640Members from included external groups and from included groups which
641are not visible to the calling user are ignored.
642
Edwin Kempin37440832013-02-06 11:36:00 +0100643.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100644----
645 GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/members/?recursive HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100646----
Edwin Kempind0a63922013-01-23 16:32:59 +0100647
Edwin Kempin37440832013-02-06 11:36:00 +0100648.Response
649----
Edwin Kempind0a63922013-01-23 16:32:59 +0100650 HTTP/1.1 200 OK
651 Content-Disposition: attachment
652 Content-Type: application/json;charset=UTF-8
653
654 )]}'
655 [
656 {
Edwin Kempin3e22d482013-03-05 15:35:25 +0100657 "_account_id": 1000097,
658 "name": "Jane Roe",
James Ring8e342722013-05-01 01:40:53 -0700659 "email": "jane.roe@example.com",
660 "username": "jane"
Edwin Kempind0a63922013-01-23 16:32:59 +0100661 },
662 {
Edwin Kempin3e22d482013-03-05 15:35:25 +0100663 "_account_id": 1000096,
664 "name": "John Doe",
James Ring8e342722013-05-01 01:40:53 -0700665 "email": "john.doe@example.com",
666 "username": "john"
Edwin Kempind0a63922013-01-23 16:32:59 +0100667 },
668 {
Edwin Kempin3e22d482013-03-05 15:35:25 +0100669 "_account_id": 1000098,
670 "name": "Richard Roe",
James Ring8e342722013-05-01 01:40:53 -0700671 "email": "richard.roe@example.com",
672 "username": "rroe"
Edwin Kempind0a63922013-01-23 16:32:59 +0100673 }
674 ]
675----
676
Edwin Kempina5cc1122013-02-11 09:26:20 +0100677[[get-group-member]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800678=== Get Group Member
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800679--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100680'GET /groups/link:#group-id[\{group-id\}]/members/link:rest-api-accounts.html#account-id[\{account-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800681--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100682
Edwin Kempina5cc1122013-02-11 09:26:20 +0100683Retrieves a group member.
684
685.Request
686----
687 GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/members/1000096 HTTP/1.0
688----
689
Edwin Kempin963dfd02013-02-27 12:39:32 +0100690As response a detailed link:rest-api-accounts.html#account-info[
691AccountInfo] entity is returned that describes the group member.
Edwin Kempina5cc1122013-02-11 09:26:20 +0100692
693.Response
694----
695 HTTP/1.1 200 OK
696 Content-Disposition: attachment
697 Content-Type: application/json;charset=UTF-8
698
699 )]}'
700 {
Edwin Kempin963dfd02013-02-27 12:39:32 +0100701 "_account_id": 1000096,
702 "name": "John Doe",
James Ring8e342722013-05-01 01:40:53 -0700703 "email": "john.doe@example.com",
704 "username": "john"
Edwin Kempina5cc1122013-02-11 09:26:20 +0100705 }
706----
707
Edwin Kempina5d6ead2013-02-06 10:59:06 +0100708[[add-group-member]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800709=== Add Group Member
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800710--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100711'PUT /groups/link:#group-id[\{group-id\}]/members/link:rest-api-accounts.html#account-id[\{account-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800712--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100713
Edwin Kempina5d6ead2013-02-06 10:59:06 +0100714Adds a user as member to a Gerrit internal group.
715
716.Request
717----
718 PUT /groups/MyProject-Committers/members/John%20Doe HTTP/1.0
719----
720
Edwin Kempin963dfd02013-02-27 12:39:32 +0100721As response a detailed link:rest-api-accounts.html#account-info[
722AccountInfo] entity is returned that describes the group member.
Edwin Kempina5d6ead2013-02-06 10:59:06 +0100723
724.Response
725----
726 HTTP/1.1 201 Created
727 Content-Disposition: attachment
728 Content-Type: application/json;charset=UTF-8
729
730 )]}'
731 {
Edwin Kempin963dfd02013-02-27 12:39:32 +0100732 "_account_id": 1000037,
733 "name": "John Doe",
James Ring8e342722013-05-01 01:40:53 -0700734 "email": "john.doe@example.com",
735 "username": "john"
Edwin Kempina5d6ead2013-02-06 10:59:06 +0100736 }
737----
738
739The request also succeeds if the user is already a member of this
740group, but then the HTTP response code is `200 OK`.
741
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800742=== Add Group Members
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800743--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100744'POST /groups/link:#group-id[\{group-id\}]/members'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800745--
Edwin Kempin2cdef5f2013-02-06 16:50:15 +0100746
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100747OR
748
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800749--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100750'POST /groups/link:#group-id[\{group-id\}]/members.add'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800751--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100752
Edwin Kempin2cdef5f2013-02-06 16:50:15 +0100753Adds one or several users to a Gerrit internal group.
754
755The users to be added to the group must be provided in the request body
Sasa Zivkov737e0a32013-03-18 14:21:42 +0100756as a link:#members-input[MembersInput] entity.
Edwin Kempin2cdef5f2013-02-06 16:50:15 +0100757
758.Request
759----
760 POST /groups/MyProject-Committers/members.add HTTP/1.0
761 Content-Type: application/json;charset=UTF-8
762
763 {
Chris St. Pierreb39fb9e2013-08-06 15:55:00 -0400764 "members": [
Edwin Kempin2cdef5f2013-02-06 16:50:15 +0100765 "jane.roe@example.com",
766 "john.doe@example.com"
Chris St. Pierreb39fb9e2013-08-06 15:55:00 -0400767 ]
Edwin Kempin2cdef5f2013-02-06 16:50:15 +0100768 }
769----
770
Edwin Kempin963dfd02013-02-27 12:39:32 +0100771As response a list of detailed link:rest-api-accounts.html#account-info[
772AccountInfo] entities is returned that describes the group members that
Sasa Zivkov737e0a32013-03-18 14:21:42 +0100773were specified in the link:#members-input[MembersInput]. An
Edwin Kempin963dfd02013-02-27 12:39:32 +0100774link:rest-api-accounts.html#account-info[AccountInfo] entity
Edwin Kempin2cdef5f2013-02-06 16:50:15 +0100775is returned for each user specified in the input, independently of
776whether the user was newly added to the group or whether the user was
777already a member of the group.
778
779.Response
780----
781 HTTP/1.1 200 OK
782 Content-Disposition: attachment
783 Content-Type: application/json;charset=UTF-8
784
785 )]}'
786 [
787 {
Edwin Kempin963dfd02013-02-27 12:39:32 +0100788 "_account_id": 1000057,
789 "name": "Jane Roe",
James Ring8e342722013-05-01 01:40:53 -0700790 "email": "jane.roe@example.com",
791 "username": "jane"
Edwin Kempin2cdef5f2013-02-06 16:50:15 +0100792 },
793 {
Edwin Kempin963dfd02013-02-27 12:39:32 +0100794 "_account_id": 1000037,
795 "name": "John Doe",
James Ring8e342722013-05-01 01:40:53 -0700796 "email": "john.doe@example.com",
797 "username": "john"
Edwin Kempin2cdef5f2013-02-06 16:50:15 +0100798 }
799 ]
800----
801
Edwin Kempinacbdfd32013-02-07 12:38:53 +0100802[[delete-group-member]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800803=== Delete Group Member
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800804--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100805'DELETE /groups/link:#group-id[\{group-id\}]/members/link:rest-api-accounts.html#account-id[\{account-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800806--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100807
Edwin Kempinacbdfd32013-02-07 12:38:53 +0100808Deletes a user from a Gerrit internal group.
809
810.Request
811----
812 DELETE /groups/MyProject-Committers/members/John%20Doe HTTP/1.0
813----
814
815.Response
816----
817 HTTP/1.1 204 No Content
818----
819
820[[delete-group-members]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800821=== Delete Group Members
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800822--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100823'POST /groups/link:#group-id[\{group-id\}]/members.delete'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800824--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100825
Edwin Kempinacbdfd32013-02-07 12:38:53 +0100826Delete one or several users from a Gerrit internal group.
827
828The users to be deleted from the group must be provided in the request
Sasa Zivkov737e0a32013-03-18 14:21:42 +0100829body as a link:#members-input[MembersInput] entity.
Edwin Kempinacbdfd32013-02-07 12:38:53 +0100830
831.Request
832----
833 POST /groups/MyProject-Committers/members.delete HTTP/1.0
834 Content-Type: application/json;charset=UTF-8
835
836 {
Chris St. Pierreb39fb9e2013-08-06 15:55:00 -0400837 "members": [
Edwin Kempinacbdfd32013-02-07 12:38:53 +0100838 "jane.roe@example.com",
839 "john.doe@example.com"
Chris St. Pierreb39fb9e2013-08-06 15:55:00 -0400840 ]
Edwin Kempinacbdfd32013-02-07 12:38:53 +0100841 }
842----
843
844.Response
845----
846 HTTP/1.1 204 No Content
847----
848
Edwin Kempin578fff72013-02-11 08:08:27 +0100849[[group-include-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800850== Group Include Endpoints
Edwin Kempin578fff72013-02-11 08:08:27 +0100851
852[[included-groups]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800853=== List Included Groups
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800854--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100855'GET /groups/link:#group-id[\{group-id\}]/groups/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800856--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100857
Edwin Kempin578fff72013-02-11 08:08:27 +0100858Lists the directly included groups of a group.
859
860As result a list of link:#group-info[GroupInfo] entries is returned.
861The entries in the list are sorted by group name and UUID.
862
863.Request
864----
865 GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/groups/ HTTP/1.0
866----
867
868.Response
869----
870 HTTP/1.1 200 OK
871 Content-Disposition: attachment
872 Content-Type: application/json;charset=UTF-8
873
874 )]}'
875 [
876 {
877 "kind": "gerritcodereview#group",
878 "id": "7ca042f4d5847936fcb90ca91057673157fd06fc",
879 "name": "MyProject-Verifiers",
Edwin Kempine05c9642013-02-11 09:36:21 +0100880 "url": "#/admin/groups/uuid-7ca042f4d5847936fcb90ca91057673157fd06fc",
881 "options": {
Edwin Kempine05c9642013-02-11 09:36:21 +0100882 },
Edwin Kempin578fff72013-02-11 08:08:27 +0100883 "group_id": 38,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100884 "owner": "MyProject-Verifiers",
Edwin Kempin578fff72013-02-11 08:08:27 +0100885 "owner_id": "7ca042f4d5847936fcb90ca91057673157fd06fc"
886 }
887 ]
888----
889
Edwin Kempina5cc1122013-02-11 09:26:20 +0100890[[get-included-group]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800891=== Get Included Group
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800892--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100893'GET /groups/link:#group-id[\{group-id\}]/groups/link:#group-id[\{group-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800894--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100895
Edwin Kempina5cc1122013-02-11 09:26:20 +0100896Retrieves an included group.
897
898.Request
899----
900 GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/groups/7ca042f4d5847936fcb90ca91057673157fd06fc HTTP/1.0
901----
902
903As response a link:#group-info[GroupInfo] entity is returned that
904describes the included group.
905
906.Response
907----
908 HTTP/1.1 200 OK
909 Content-Disposition: attachment
910 Content-Type: application/json;charset=UTF-8
911
912 )]}'
913 {
914 "kind": "gerritcodereview#group",
915 "id": "7ca042f4d5847936fcb90ca91057673157fd06fc",
916 "name": "MyProject-Verifiers",
917 "url": "#/admin/groups/uuid-7ca042f4d5847936fcb90ca91057673157fd06fc",
918 "options": {
Edwin Kempina5cc1122013-02-11 09:26:20 +0100919 },
920 "group_id": 38,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100921 "owner": "Administrators",
Edwin Kempina5cc1122013-02-11 09:26:20 +0100922 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
923 }
924----
925
Edwin Kempin2689e3d2013-02-07 15:52:36 +0100926[[include-group]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800927=== Include Group
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800928--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100929'PUT /groups/link:#group-id[\{group-id\}]/groups/link:#group-id[\{group-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800930--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100931
Dariusz Lukszaccfa6492013-06-07 11:07:38 +0200932Includes an internal or external group into a Gerrit internal group.
933External groups must be specified using the UUID.
Edwin Kempin2689e3d2013-02-07 15:52:36 +0100934
935.Request
936----
937 PUT /groups/MyProject-Committers/groups/MyGroup HTTP/1.0
938----
939
940As response a link:#group-info[GroupInfo] entity is returned that
941describes the included group.
942
943.Response
944----
945 HTTP/1.1 201 Created
946 Content-Disposition: attachment
947 Content-Type: application/json;charset=UTF-8
948
949 )]}'
950 {
951 "kind": "gerritcodereview#group",
952 "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
953 "name": "MyGroup",
954 "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
955 "options": {
Edwin Kempin2689e3d2013-02-07 15:52:36 +0100956 },
957 "group_id": 8,
Edwin Kempinc6993fb2013-02-11 12:39:13 +0100958 "owner": "Administrators",
Edwin Kempin2689e3d2013-02-07 15:52:36 +0100959 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
960 }
961----
962
963The request also succeeds if the group is already included in this
964group, but then the HTTP response code is `200 OK`.
965
John Spurlockd25fad12013-03-09 11:48:49 -0500966[[include-groups]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800967=== Include Groups
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800968--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100969'POST /groups/link:#group-id[\{group-id\}]/groups'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800970--
Edwin Kempin2689e3d2013-02-07 15:52:36 +0100971
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100972OR
973
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800974--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100975'POST /groups/link:#group-id[\{group-id\}]/groups.add'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800976--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100977
Edwin Kempin2689e3d2013-02-07 15:52:36 +0100978Includes one or several groups into a Gerrit internal group.
979
980The groups to be included into the group must be provided in the
981request body as a link:#groups-input[GroupsInput] entity.
982
983.Request
984----
985 POST /groups/MyProject-Committers/groups.add HTTP/1.0
986 Content-Type: application/json;charset=UTF-8
987
988 {
989 "groups": {
990 "MyGroup",
991 "MyOtherGroup"
992 }
993 }
994----
995
996As response a list of link:#group-info[GroupInfo] entities is
997returned that describes the groups that were specified in the
998link:#groups-input[GroupsInput]. A link:#group-info[GroupInfo] entity
999is returned for each group specified in the input, independently of
1000whether the group was newly included into the group or whether the
1001group was already included in the group.
1002
1003.Response
1004----
1005 HTTP/1.1 200 OK
1006 Content-Disposition: attachment
1007 Content-Type: application/json;charset=UTF-8
1008
1009 )]}'
1010 [
1011 {
1012 "kind": "gerritcodereview#group",
1013 "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
1014 "name": "MyGroup",
1015 "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
1016 "options": {
Edwin Kempin2689e3d2013-02-07 15:52:36 +01001017 },
1018 "group_id": 8,
Edwin Kempinc6993fb2013-02-11 12:39:13 +01001019 "owner": "Administrators",
Edwin Kempin2689e3d2013-02-07 15:52:36 +01001020 "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
1021 },
1022 {
1023 "kind": "gerritcodereview#group",
1024 "id": "5057f3cbd3519d6ab69364429a89ffdffba50f73",
1025 "name": "MyOtherGroup",
1026 "url": "#/admin/groups/uuid-5057f3cbd3519d6ab69364429a89ffdffba50f73",
1027 "options": {
Edwin Kempin2689e3d2013-02-07 15:52:36 +01001028 },
1029 "group_id": 10,
Edwin Kempinc6993fb2013-02-11 12:39:13 +01001030 "owner": "MyOtherGroup",
Edwin Kempin2689e3d2013-02-07 15:52:36 +01001031 "owner_id": "5057f3cbd3519d6ab69364429a89ffdffba50f73"
1032 }
1033 ]
1034----
1035
1036[[delete-included-group]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001037=== Delete Included Group
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001038--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001039'DELETE /groups/link:#group-id[\{group-id\}]/groups/link:#group-id[\{group-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001040--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001041
Edwin Kempin2689e3d2013-02-07 15:52:36 +01001042Deletes an included group from a Gerrit internal group.
1043
1044.Request
1045----
1046 DELETE /groups/MyProject-Committers/groups/MyGroup HTTP/1.0
1047----
1048
1049.Response
1050----
1051 HTTP/1.1 204 No Content
1052----
1053
1054[[delete-included-groups]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001055=== Delete Included Groups
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001056--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001057'POST /groups/link:#group-id[\{group-id\}]/groups.delete'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001058--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001059
Edwin Kempin2689e3d2013-02-07 15:52:36 +01001060Delete one or several included groups from a Gerrit internal group.
1061
1062The groups to be deleted from the group must be provided in the request
1063body as a link:#groups-input[GroupsInput] entity.
1064
1065.Request
1066----
1067 POST /groups/MyProject-Committers/groups.delete HTTP/1.0
1068 Content-Type: application/json;charset=UTF-8
1069
1070 {
1071 "members": {
1072 "MyGroup",
1073 "MyOtherGroup"
1074 }
1075 }
1076----
1077
1078.Response
1079----
1080 HTTP/1.1 204 No Content
1081----
1082
Edwin Kempinaa266ff2013-02-05 12:41:09 +01001083
Edwin Kempin34d83352013-02-06 10:40:17 +01001084[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001085== IDs
Edwin Kempin34d83352013-02-06 10:40:17 +01001086
Edwin Kempin2cdef5f2013-02-06 16:50:15 +01001087[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001088=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempin4efe2572013-02-27 10:16:17 +01001089--
1090--
Edwin Kempina5d6ead2013-02-06 10:59:06 +01001091
Edwin Kempin2689e3d2013-02-07 15:52:36 +01001092[[group-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001093=== \{group-id\}
Edwin Kempin34d83352013-02-06 10:40:17 +01001094Identifier for a group.
1095
1096This can be:
1097
1098* the UUID of the group
1099* the legacy numeric ID of the group
1100* the name of the group if it is unique
1101
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001102[[group-name]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001103=== \{group-name\}
Edwin Kempin34d83352013-02-06 10:40:17 +01001104Group name that uniquely identifies one group.
1105
1106
Edwin Kempin987d5432013-02-04 10:20:44 +01001107[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001108== JSON Entities
Edwin Kempin987d5432013-02-04 10:20:44 +01001109
1110[[group-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001111=== GroupInfo
Edwin Kempin987d5432013-02-04 10:20:44 +01001112The `GroupInfo` entity contains information about a group. This can be
1113a Gerrit internal group, or an external group that is known to Gerrit.
1114
1115[options="header",width="50%",cols="1,^1,5"]
1116|===========================
1117|Field Name ||Description
1118|`kind` ||`gerritcodereview#group`
1119|`id` ||The URL encoded UUID of the group.
Edwin Kempin5b591d12013-03-08 09:18:35 +01001120|`name` |
1121not set if returned in a map where the group name is used as map key|
1122The name of the group.
Edwin Kempin987d5432013-02-04 10:20:44 +01001123|`url` |optional|
1124URL to information about the group. Typically a URL to a web page that
1125permits users to apply to join the group, or manage their membership.
1126|`options` ||link:#group-options-info[Options of the group]
1127|`description` |only for internal groups|The description of the group.
1128|`group_id` |only for internal groups|The numeric ID of the group.
Edwin Kempinc6993fb2013-02-11 12:39:13 +01001129|`owner` |only for internal groups|The name of the owner group.
Edwin Kempin987d5432013-02-04 10:20:44 +01001130|`owner_id` |only for internal groups|The URL encoded UUID of the owner group.
Edwin Kempinabaab5462013-02-11 15:30:19 +01001131|`members` |optional, only for internal groups|
1132A list of link:rest-api-accounts.html#account-info[AccountInfo]
1133entities describing the direct members. +
1134Only set if link:#members[members] are requested.
1135|`includes` |optional, only for internal groups|
1136A list of link:#group-info[GroupInfo] entities describing the directly
1137included groups. +
1138Only set if link:#includes[included groups] are requested.
Edwin Kempin987d5432013-02-04 10:20:44 +01001139|===========================
1140
Edwin Kempinc42abb92013-02-04 14:52:41 +01001141The type of a group can be deduced from the group's UUID:
1142[width="50%"]
1143|============
1144|UUID matches "^[0-9a-f]\{40\}$"|Gerrit internal group
1145|UUID starts with "global:"|Gerrit system group
1146|UUID starts with "ldap:"|LDAP group
1147|UUID starts with "<prefix>:"|other external group
1148|============
1149
Edwin Kempinaa266ff2013-02-05 12:41:09 +01001150[[group-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001151=== GroupInput
Edwin Kempinaa266ff2013-02-05 12:41:09 +01001152The 'GroupInput' entity contains information for the creation of
1153a new internal group.
1154
1155[options="header",width="50%",cols="1,^1,5"]
1156|===========================
1157|Field Name ||Description
1158|`name` |optional|The name of the group (not encoded). +
1159If set, must match the group name in the URL.
1160|`description` |optional|The description of the group.
1161|`visible_to_all`|optional|
1162Whether the group is visible to all registered users. +
1163`false` if not set.
1164|`owner_id`|optional|The URL encoded ID of the owner group. +
1165This can be a group UUID, a legacy numeric group ID or a unique group
1166name. +
1167If not set, the new group will be self-owned.
1168|===========================
1169
Edwin Kempin2689e3d2013-02-07 15:52:36 +01001170[[groups-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001171=== GroupsInput
Edwin Kempin2689e3d2013-02-07 15:52:36 +01001172The `GroupsInput` entity contains information about groups that should
1173be included into a group or that should be deleted from a group.
1174
1175[options="header",width="50%",cols="1,^1,5"]
1176|==========================
1177|Field Name ||Description
1178|`_one_group` |optional|
1179The link:#group-id[id] of one group that should be included or deleted.
1180|`groups` |optional|
1181A list of link:#group-id[group ids] that identify the groups that
1182should be included or deleted.
1183|==========================
1184
Edwin Kempin987d5432013-02-04 10:20:44 +01001185[[group-options-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001186=== GroupOptionsInfo
Edwin Kempin987d5432013-02-04 10:20:44 +01001187Options of the group.
1188
1189[options="header",width="50%",cols="1,^1,5"]
Edwin Kempinf04fc9c2013-02-05 14:09:45 +01001190|=============================
1191|Field Name ||Description
Edwin Kempinf04fc9c2013-02-05 14:09:45 +01001192|`visible_to_all`|not set if `false`|
Edwin Kempin987d5432013-02-04 10:20:44 +01001193Whether the group is visible to all registered users.
Edwin Kempinf04fc9c2013-02-05 14:09:45 +01001194|=============================
Edwin Kempin987d5432013-02-04 10:20:44 +01001195
Edwin Kempin1461c222013-02-11 08:41:08 +01001196[[group-options-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001197=== GroupOptionsInput
Edwin Kempin1461c222013-02-11 08:41:08 +01001198New options for a group.
1199
1200[options="header",width="50%",cols="1,^1,5"]
1201|=============================
1202|Field Name ||Description
1203|`visible_to_all`|not set if `false`|
1204Whether the group is visible to all registered users.
1205|=============================
1206
Sasa Zivkov737e0a32013-03-18 14:21:42 +01001207[[members-input]]
1208MembersInput
Edwin Kempin2cdef5f2013-02-06 16:50:15 +01001209~~~~~~~~~~~
Sasa Zivkov737e0a32013-03-18 14:21:42 +01001210The `MembersInput` entity contains information about accounts that should
Edwin Kempinacbdfd32013-02-07 12:38:53 +01001211be added as members to a group or that should be deleted from the group.
Edwin Kempin2cdef5f2013-02-06 16:50:15 +01001212
1213[options="header",width="50%",cols="1,^1,5"]
1214|==========================
1215|Field Name ||Description
1216|`_one_member`|optional|
Edwin Kempinacbdfd32013-02-07 12:38:53 +01001217The link:#account-id[id] of one account that should be added or
1218deleted.
Edwin Kempin2cdef5f2013-02-06 16:50:15 +01001219|`members` |optional|
1220A list of link:#account-id[account ids] that identify the accounts that
Edwin Kempinacbdfd32013-02-07 12:38:53 +01001221should be added or deleted.
Edwin Kempin2cdef5f2013-02-06 16:50:15 +01001222|==========================
1223
1224
Edwin Kempind0a63922013-01-23 16:32:59 +01001225GERRIT
1226------
1227Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07001228
1229SEARCHBOX
1230---------