summaryrefslogtreecommitdiffstats
path: root/Documentation/rest-api-groups.txt
blob: 00fd81f62acbd0b5178fcb2ab503419afa6c699d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
= Gerrit Code Review - /groups/ REST API

This page describes the group related REST endpoints.
Please also take note of the general information on the
link:rest-api.html[REST API].

[[group-endpoints]]
== Group Endpoints

[[list-groups]]
=== List Groups
--
'GET /groups/'
--

Lists the groups accessible by the caller. This is the same as
using the link:cmd-ls-groups.html[ls-groups] command over SSH,
and accepts the same options as query parameters.

As result a map is returned that maps the group names to
link:#group-info[GroupInfo] entries. The entries in the map are sorted
by group name.

.Request
----
  GET /groups/ HTTP/1.0
----

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "Administrators": {
      "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "options": {
      },
      "description": "Gerrit Site Administrators",
      "group_id": 1,
      "owner": "Administrators",
      "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "created_on": "2013-02-01 09:59:32.126000000"
    },
    "Anonymous Users": {
      "id": "global%3AAnonymous-Users",
      "url": "#/admin/groups/uuid-global%3AAnonymous-Users",
      "options": {
      },
      "description": "Any user, signed-in or not",
      "group_id": 2,
      "owner": "Administrators",
      "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "created_on": "2013-02-01 09:59:32.126000000"
    },
    "MyProject_Committers": {
      "id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7",
      "url": "#/admin/groups/uuid-834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7",
      "options": {
        "visible_to_all": true,
      },
      "group_id": 6,
      "owner": "MyProject_Committers",
      "owner_id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7",
      "created_on": "2013-02-01 09:59:32.126000000"
    },
    "Non-Interactive Users": {
      "id": "5057f3cbd3519d6ab69364429a89ffdffba50f73",
      "url": "#/admin/groups/uuid-5057f3cbd3519d6ab69364429a89ffdffba50f73",
      "options": {
      },
      "description": "Users who perform batch actions on Gerrit",
      "group_id": 4,
      "owner": "Administrators",
      "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "created_on": "2013-02-01 09:59:32.126000000"
    },
    "Project Owners": {
      "id": "global%3AProject-Owners",
      "url": "#/admin/groups/uuid-global%3AProject-Owners",
      "options": {
      },
      "description": "Any owner of the project",
      "group_id": 5,
      "owner": "Administrators",
      "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "created_on": "2013-02-01 09:59:32.126000000"
    },
    "Registered Users": {
      "id": "global%3ARegistered-Users",
      "url": "#/admin/groups/uuid-global%3ARegistered-Users",
      "options": {
      },
      "description": "Any signed-in user",
      "group_id": 3,
      "owner": "Administrators",
      "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "created_on": "2013-02-01 09:59:32.126000000"
    }
  }
----

.Get all groups
****
get::/groups/
****

[[group-options]]
==== Group Options
Additional fields can be obtained by adding `o` parameters, each option
requires more lookups and slows down the query response time to the
client so they are generally disabled by default. Optional fields are:

[[includes]]
--
* `INCLUDES`: include list of direct subgroups.
--

[[members]]
--
* `MEMBERS`: include list of direct group members.
--

==== Find groups that are owned by another group

By setting `ownedBy` and specifying the link:#group-id[\{group-id\}] of another
group, it is possible to find all the groups for which the owning group is the
given group.

.Request
----
  GET /groups/?ownedBy=7ca042f4d5847936fcb90ca91057673157fd06fc HTTP/1.0
----

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "MyProject-Committers": {
      "id": "9999c971bb4ab872aab759d8c49833ee6b9ff320",
      "url": "#/admin/groups/uuid-9999c971bb4ab872aab759d8c49833ee6b9ff320",
      "options": {
        "visible_to_all": true
      },
      "description":"contains all committers for MyProject",
      "group_id": 551,
      "owner": "MyProject-Owners",
      "owner_id": "7ca042f4d5847936fcb90ca91057673157fd06fc",
      "created_on": "2013-02-01 09:59:32.126000000"
    }
  }
----

==== Check if a group is owned by the calling user
By setting the option `owned` and specifying a group to inspect with
the option `group`/`g`, it is possible to find out if this group is
owned by the calling user.

[NOTE] Earlier the `group`/`g` option was named `query`/`q`. Using
`query`/`q` still works, but this option is deprecated and may be
removed in future. Hence all users should be adapted to use
`group`/`g` instead.

.Request
----
  GET /groups/?owned&q=MyProject-Committers HTTP/1.0
----

If the group is owned by the calling user, the returned map contains
this group. If the calling user doesn't own this group an empty map is
returned.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "MyProject-Committers": {
      "id": "9999c971bb4ab872aab759d8c49833ee6b9ff320",
      "url": "#/admin/groups/uuid-9999c971bb4ab872aab759d8c49833ee6b9ff320",
      "options": {
        "visible_to_all": true
      },
      "description":"contains all committers for MyProject",
      "group_id": 551,
      "owner": "MyProject-Owners",
      "owner_id": "7ca042f4d5847936fcb90ca91057673157fd06fc",
      "created_on": "2013-02-01 09:59:32.126000000"
    }
  }
----

[[group-limit]]
==== Group Limit
The `/groups/` URL also accepts a limit integer in the `n` parameter.
This limits the results to show `n` groups.

Query the first 25 groups in group list.
----
  GET /groups/?n=25 HTTP/1.0
----

The `/groups/` URL also accepts a start integer in the `S` parameter.
The results will skip `S` groups from group list.

Query 25 groups starting from index 50.
----
  GET /groups/?n=25&S=50 HTTP/1.0
----

[[suggest-group]]
==== Suggest Group
The `suggest` or `s` option indicates a user-entered string that
should be auto-completed to group names.
If this option is set and `n` is not set, then `n` defaults to 10.

When using this option, the `project` or `p` option can be used to
name the current project, to allow context-dependent suggestions.

Not compatible with `visible-to-all`, `owned`, `user`, `match`,
`group`, or `S`.
(Attempts to use one of those options combined with `suggest` will
error out.)

.Request
----
  GET /groups/?suggest=ad&p=All-Projects HTTP/1.0
----

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "Administrators": {
      "url": "#/admin/groups/uuid-59b92f35489e62c80d1ab1bf0c2d17843038df8b",
      "options": {},
      "description": "Gerrit Site Administrators",
      "group_id": 1,
      "owner": "Administrators",
      "owner_id": "59b92f35489e62c80d1ab1bf0c2d17843038df8b",
      "created_on": "2013-02-01 09:59:32.126000000",
      "id": "59b92f35489e62c80d1ab1bf0c2d17843038df8b"
    }
  }
----

Regex(r)::
Limit the results to those groups that match the specified regex.
+
Boundary matchers '^' and '$' are implicit. For example: the regex 'test.*' will
match any groups that start with 'test' and regex '.*test' will match any
group that end with 'test'.
+
The match is case sensitive.
+
List all groups that match regex `test.*group`:
+
.Request
----
  GET /groups/?r=test.*group HTTP/1.0
----
+
.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "test/some-group": {
      "url": "#/admin/groups/uuid-59b92f35489e62c80d1ab1bf0c2d17843038df8b",
      "options": {},
      "description": "Gerrit Site Administrators",
      "group_id": 1,
      "owner": "Administrators",
      "owner_id": "59b92f35489e62c80d1ab1bf0c2d17843038df8b",
      "created_on": "2013-02-01 09:59:32.126000000",
      "id": "59b92f35489e62c80d1ab1bf0c2d17843038df8b"
    }
    "test/some-other-group": {
      "url": "#/admin/groups/uuid-99b92f35489e62c80d1ab1bf0c2d17843038df8b",
      "options": {},
      "description": "Gerrit Site Administrators",
      "group_id": 1,
      "owner": "Administrators",
      "owner_id": "99b92f35489e62c80d1ab1bf0c2d17843038df8b",
      "created_on": "2014-02-01 09:59:32.126000000",
      "id": "99b92f35489e62c80d1ab1bf0c2d17843038df8b"
    }
  }

----

Substring(m)::
Limit the results to those groups that match the specified substring.
+
The match is case insensitive.
+
List all groups that match substring `test/`:
+
.Request
----
  GET /groups/?m=test%2F HTTP/1.0
----
+
.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "test/test": {
      "url": "#/admin/groups/uuid-786a95e85f9a2223a96545f10003f396aba871f2",
      "options": {},
      "group_id": 15,
      "owner": "test/test",
      "owner_id": "786a95e85f9a2223a96545f10003f396aba871f2",
      "created_on": "2017-07-11 13:56:24.000000000",
      "id": "786a95e85f9a2223a96545f10003f396aba871f2"
    }
  }
----

[[query-groups]]
=== Query Groups
--
'GET /groups/?query2=<query>'
--

Queries internal groups visible to the caller. The
link:user-search-groups.html#_search_operators[query string] must be
provided by the `query2` parameter. The `start` and `limit` parameters
can be used to skip/limit results.

As result a list of link:#group-info[GroupInfo] entities is returned.

[NOTE] `query2` is a temporary name and in future this option may be
renamed to `query`. `query2` was chosen to maintain backwards
compatibility with the deprecated `query` parameter on the
link:#list-groups[List Groups] endpoint.

.Request
----
  GET /groups/?query2=inname:test HTTP/1.0
----

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  [
    {
      "url": "#/admin/groups/uuid-68236a40ca78de8be630312d8ba50250bc5638ae",
      "options": {},
      "description": "Group for running tests on MyProject",
      "group_id": 20,
      "owner": "MyProject-Test-Group",
      "owner_id": "59b92f35489e62c80d1ab1bf0c2d17843038df8b",
      "created_on": "2013-02-01 09:59:32.126000000",
      "id": "68236a40ca78de8be630312d8ba50250bc5638ae"
    },
    {
      "url": "#/admin/groups/uuid-99a534526313324a2667025c3f4e089199b736aa",
      "options": {},
      "description": "Testers for ProjectX",
      "group_id": 17,
      "owner": "ProjectX-Testers",
      "owner_id": "59b92f35489e62c80d1ab1bf0c2d17843038df8b",
      "created_on": "2013-02-01 09:59:32.126000000",
      "id": "99a534526313324a2667025c3f4e089199b736aa"
    }
  ]
----

If the number of groups matching the query exceeds either the internal
limit or a supplied `limit` query parameter, the last group object has
a `_more_groups: true` JSON field set.

[[group-query-limit]]
==== Group Limit
The `/groups/?query2=<query>` URL also accepts a limit integer in the
`limit` parameter. This limits the results to `limit` groups.

Query the first 25 groups in group list.
----
  GET /groups/?query2=<query>&limit=25 HTTP/1.0
----

The `/groups/` URL also accepts a start integer in the `start`
parameter. The results will skip `start` groups from group list.

Query 25 groups starting from index 50.
----
  GET /groups/?query2=<query>&limit=25&start=50 HTTP/1.0
----

[[group-query-options]]
==== Group Options
Additional fields can be obtained by adding `o` parameters. Each option
requires more lookups and slows down the query response time to the
client so they are generally disabled by default. The supported fields
are described in the context of the link:#group-options[List Groups]
REST endpoint.

[[get-group]]
=== Get Group
--
'GET /groups/link:#group-id[\{group-id\}]'
--

Retrieves a group.

.Request
----
  GET /groups/6a1e70e1a88782771a91808c8af9bbb7a9871389 HTTP/1.0
----

As response a link:#group-info[GroupInfo] entity is returned that
describes the group.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "name": "Administrators",
    "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "options": {
    },
    "description": "Gerrit Site Administrators",
    "group_id": 1,
    "owner": "Administrators",
    "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "created_on": "2013-02-01 09:59:32.126000000"
  }
----

[[create-group]]
=== Create Group
--
'PUT /groups/link:#group-name[\{group-name\}]'
--

Creates a new Gerrit internal group.

In the request body additional data for the group can be provided as
link:#group-input[GroupInput].

.Request
----
  PUT /groups/MyProject-Committers HTTP/1.0
  Content-Type: application/json; charset=UTF-8

  {
    "description": "contains all committers for MyProject",
    "visible_to_all": true,
    "owner": "MyProject-Owners",
    "owner_id": "7ca042f4d5847936fcb90ca91057673157fd06fc"
  }
----

As response the link:#group-info[GroupInfo] entity is returned that
describes the created group.

.Response
----
  HTTP/1.1 201 Created
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "id": "9999c971bb4ab872aab759d8c49833ee6b9ff320",
    "name": "MyProject-Committers",
    "url": "#/admin/groups/uuid-9999c971bb4ab872aab759d8c49833ee6b9ff320",
    "options": {
      "visible_to_all": true
    },
    "description":"contains all committers for MyProject",
    "group_id": 551,
    "owner": "MyProject-Owners",
    "owner_id": "7ca042f4d5847936fcb90ca91057673157fd06fc",
    "created_on": "2013-02-01 09:59:32.126000000"
  }
----

If the group creation fails because the name is already in use the
response is "`409 Conflict`".

[[get-group-detail]]
=== Get Group Detail
--
'GET /groups/link:#group-id[\{group-id\}]/detail'
--

Retrieves a group with the direct link:#members[members] and the
directly link:#includes[included groups].

.Request
----
  GET /groups/6a1e70e1a88782771a91808c8af9bbb7a9871389/detail HTTP/1.0
----

As response a link:#group-info[GroupInfo] entity is returned that
describes the group.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "name": "Administrators",
    "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "options": {
    },
    "description": "Gerrit Site Administrators",
    "group_id": 1,
    "owner": "Administrators",
    "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "created_on": "2013-02-01 09:59:32.126000000",
    "members": [
      {
        "_account_id": 1000097,
        "name": "Jane Roe",
        "email": "jane.roe@example.com",
        "username": "jane"
      },
      {
        "_account_id": 1000096,
        "name": "John Doe",
        "email": "john.doe@example.com"
        "username": "john"
      }
    ],
    "includes": []
  }
----

[[get-group-name]]
=== Get Group Name
--
'GET /groups/link:#group-id[\{group-id\}]/name'
--

Retrieves the name of a group.

.Request
----
  GET /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/name HTTP/1.0
----

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  "MyProject-Committers"
----

[[rename-group]]
=== Rename Group
--
'PUT /groups/link:#group-id[\{group-id\}]/name'
--

Renames a Gerrit internal group.

The new group name must be provided in the request body.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  PUT /groups/MyProject-Committers/name HTTP/1.0
  Content-Type: application/json; charset=UTF-8

  {
    "name": "My-Project-Committers"
  }
----

As response the new group name is returned.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  "My-Project-Committers"
----

If renaming the group fails because the new name is already in use the
response is "`409 Conflict`".

[[get-group-description]]
=== Get Group Description
--
'GET /groups/link:#group-id[\{group-id\}]/description'
--

Retrieves the description of a group.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  GET /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/description HTTP/1.0
----

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  "contains all committers for MyProject"
----

If the group does not have a description an empty string is returned.

[[set-group-description]]
=== Set Group Description
--
'PUT /groups/link:#group-id[\{group-id\}]/description'
--

Sets the description of a Gerrit internal group.

The new group description must be provided in the request body.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  PUT /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/description HTTP/1.0
  Content-Type: application/json; charset=UTF-8

  {
    "description": "The committers of MyProject."
  }
----

As response the new group description is returned.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  "The committers of MyProject."
----

If the description was deleted the response is "`204 No Content`".

[[delete-group-description]]
=== Delete Group Description
--
'DELETE /groups/link:#group-id[\{group-id\}]/description'
--

Deletes the description of a Gerrit internal group.

.Request
----
  DELETE /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/description HTTP/1.0
----

.Response
----
  HTTP/1.1 204 No Content
----

[[get-group-options]]
=== Get Group Options
--
'GET /groups/link:#group-id[\{group-id\}]/options'
--

Retrieves the options of a group.

.Request
----
  GET /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/options HTTP/1.0
----

As response a link:#group-options-info[GroupOptionsInfo] entity is
returned that describes the options of the group.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "visible_to_all": true
  }
----

[[set-group-options]]
=== Set Group Options
--
'PUT /groups/link:#group-id[\{group-id\}]/options'
--

Sets the options of a Gerrit internal group.

The new group options must be provided in the request body as a
link:#group-options-input[GroupOptionsInput] entity.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  PUT /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/options HTTP/1.0
  Content-Type: application/json; charset=UTF-8

  {
    "visible_to_all": true
  }
----

As response the new group options are returned as a
link:#group-options-info[GroupOptionsInfo] entity.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "visible_to_all": true
  }
----

[[get-group-owner]]
=== Get Group Owner
--
'GET /groups/link:#group-id[\{group-id\}]/owner'
--

Retrieves the owner group of a Gerrit internal group.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  GET /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/owner HTTP/1.0
----

As response a link:#group-info[GroupInfo] entity is returned that
describes the owner group.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "name": "Administrators",
    "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "options": {
    },
    "description": "Gerrit Site Administrators",
    "group_id": 1,
    "owner": "Administrators",
    "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "created_on": "2013-02-01 09:59:32.126000000"
  }
----

[[set-group-owner]]
=== Set Group Owner
--
'PUT /groups/link:#group-id[\{group-id\}]/owner'
--

Sets the owner group of a Gerrit internal group.

The new owner group must be provided in the request body.

The new owner can be specified by name, by group UUID or by the legacy
numeric group ID.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  PUT /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/owner HTTP/1.0
  Content-Type: application/json; charset=UTF-8

  {
    "owner": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
  }
----

As response a link:#group-info[GroupInfo] entity is returned that
describes the new owner group.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "name": "Administrators",
    "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "options": {
    },
    "description": "Gerrit Site Administrators",
    "group_id": 1,
    "owner": "Administrators",
    "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "created_on": "2013-02-01 09:59:32.126000000"
  }
----

[[get-audit-log]]
=== Get Audit Log
--
'GET /groups/link:#group-id[\{group-id\}]/log.audit'
--

Gets the audit log of a Gerrit internal group.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  GET /groups/9999c971bb4ab872aab759d8c49833ee6b9ff320/log.audit HTTP/1.0
----

As response a list of link:#group-audit-event-info[GroupAuditEventInfo]
entities is returned that describes the audit events of the group. The
returned audit events are sorted by date in reverse order so that the
newest audit event comes first.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  [
    {
      "member": {
        "url": "#/admin/groups/uuid-fdda826a0815859ab48d22a05a43472f0f55f89a",
        "options": {},
        "group_id": 3,
        "owner": "Administrators",
        "owner_id": "e56678641565e7f59dd5c6878f5bcbc842bf150a",
        "created_on": "2013-02-01 09:59:32.126000000",
        "id": "fdda826a0815859ab48d22a05a43472f0f55f89a",
        "name": "MyGroup"
      },
      "type": "REMOVE_GROUP",
      "user": {
        "_account_id": 1000000,
        "name": "Administrator",
        "email": "admin@example.com",
        "username": "admin"
      },
      "date": "2015-07-03 09:22:26.348000000"
    },
    {
      "member": {
        "url": "#/admin/groups/uuid-fdda826a0815859ab48d22a05a43472f0f55f89a",
        "options": {},
        "group_id": 3,
        "owner": "Administrators",
        "owner_id": "e56678641565e7f59dd5c6878f5bcbc842bf150a",
        "created_on": "2013-02-01 09:59:32.126000000",
        "id": "fdda826a0815859ab48d22a05a43472f0f55f89a",
        "name": "MyGroup"
      },
      "type": "ADD_GROUP",
      "user": {
        "_account_id": 1000000,
        "name": "Administrator",
        "email": "admin@example.com",
        "username": "admin"
      },
      "date": "2015-07-03 08:43:36.592000000"
    },
    {
      "member": {
        "_account_id": 1000000,
        "name": "Administrator",
        "email": "admin@example.com",
        "username": "admin"
      },
      "type": "ADD_USER",
      "user": {
        "_account_id": 1000001,
        "name": "John Doe",
        "email": "john.doe@example.com",
        "username": "jdoe"
      },
      "date": "2015-07-01 13:36:36.602000000"
    }
  ]
----

[[index-group]]
=== Index Group
--
'POST /groups/link:#group-id[\{group-id\}]/index'
--

Adds or updates the internal group in the secondary index.

.Request
----
  POST /groups/fdda826a0815859ab48d22a05a43472f0f55f89a/index HTTP/1.0
----

.Response
----
  HTTP/1.1 204 No Content
----

[[group-member-endpoints]]
== Group Member Endpoints

[[group-members]]
=== List Group Members
--
'GET /groups/link:#group-id[\{group-id\}]/members/'
--

Lists the direct members of a Gerrit internal group.

As result a list of detailed link:rest-api-accounts.html#account-info[
AccountInfo] entries is returned. The entries in the list are sorted by
full name, preferred email and id.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/members/ HTTP/1.0
----

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  [
    {
      "_account_id": 1000097,
      "name": "Jane Roe",
      "email": "jane.roe@example.com",
      "username": "jane"
    },
    {
      "_account_id": 1000096,
      "name": "John Doe",
      "email": "john.doe@example.com",
      "username": "john"
    }
  ]
----

.Get all members of the 'Administrators' group (normally group id = 1)
****
get::/groups/1/members/
****

To resolve the included groups of a group recursively and to list all
members the parameter `recursive` can be set.

Members from included external groups and from included groups which
are not visible to the calling user are ignored.

.Request
----
  GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/members/?recursive HTTP/1.0
----

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  [
    {
      "_account_id": 1000097,
      "name": "Jane Roe",
      "email": "jane.roe@example.com",
      "username": "jane"
    },
    {
      "_account_id": 1000096,
      "name": "John Doe",
      "email": "john.doe@example.com",
      "username": "john"
    },
    {
      "_account_id": 1000098,
      "name": "Richard Roe",
      "email": "richard.roe@example.com",
      "username": "rroe"
    }
  ]
----

[[get-group-member]]
=== Get Group Member
--
'GET /groups/link:#group-id[\{group-id\}]/members/link:rest-api-accounts.html#account-id[\{account-id\}]'
--

Retrieves a group member.

.Request
----
  GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/members/1000096 HTTP/1.0
----

As response a detailed link:rest-api-accounts.html#account-info[
AccountInfo] entity is returned that describes the group member.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "_account_id": 1000096,
    "name": "John Doe",
    "email": "john.doe@example.com",
    "username": "john"
  }
----

[[add-group-member]]
=== Add Group Member
--
'PUT /groups/link:#group-id[\{group-id\}]/members/link:rest-api-accounts.html#account-id[\{account-id\}]'
--

Adds a user as member to a Gerrit internal group.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  PUT /groups/MyProject-Committers/members/John%20Doe HTTP/1.0
----

As response a detailed link:rest-api-accounts.html#account-info[
AccountInfo] entity is returned that describes the group member.

.Response
----
  HTTP/1.1 201 Created
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "_account_id": 1000037,
    "name": "John Doe",
    "email": "john.doe@example.com",
    "username": "john"
  }
----

The request also succeeds if the user is already a member of this
group, but then the HTTP response code is `200 OK`.

=== Add Group Members
--
'POST /groups/link:#group-id[\{group-id\}]/members'
--

OR

--
'POST /groups/link:#group-id[\{group-id\}]/members.add'
--

Adds one or several users to a Gerrit internal group.

The users to be added to the group must be provided in the request body
as a link:#members-input[MembersInput] entity.

.Request
----
  POST /groups/MyProject-Committers/members.add HTTP/1.0
  Content-Type: application/json; charset=UTF-8

  {
    "members": [
      "jane.roe@example.com",
      "john.doe@example.com"
    ]
  }
----

As response a list of detailed link:rest-api-accounts.html#account-info[
AccountInfo] entities is returned that describes the group members that
were specified in the link:#members-input[MembersInput]. An
link:rest-api-accounts.html#account-info[AccountInfo] entity
is returned for each user specified in the input, independently of
whether the user was newly added to the group or whether the user was
already a member of the group.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  [
    {
      "_account_id": 1000057,
      "name": "Jane Roe",
      "email": "jane.roe@example.com",
      "username": "jane"
    },
    {
      "_account_id": 1000037,
      "name": "John Doe",
      "email": "john.doe@example.com",
      "username": "john"
    }
  ]
----

[[remove-group-member]]
=== Remove Group Member
--
'DELETE /groups/link:#group-id[\{group-id\}]/members/link:rest-api-accounts.html#account-id[\{account-id\}]'
--

Removes a user from a Gerrit internal group.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  DELETE /groups/MyProject-Committers/members/John%20Doe HTTP/1.0
----

.Response
----
  HTTP/1.1 204 No Content
----

[[remove-group-members]]
=== Remove Group Members
--
'POST /groups/link:#group-id[\{group-id\}]/members.delete'
--

Removes one or several users from a Gerrit internal group.

The users to be removed from the group must be provided in the request
body as a link:#members-input[MembersInput] entity.

.Request
----
  POST /groups/MyProject-Committers/members.delete HTTP/1.0
  Content-Type: application/json; charset=UTF-8

  {
    "members": [
      "jane.roe@example.com",
      "john.doe@example.com"
    ]
  }
----

.Response
----
  HTTP/1.1 204 No Content
----

[[subgroup-endpoints]]
== Subgroup Endpoints

[[list-subgroups]]
=== List Subgroups
--
'GET /groups/link:#group-id[\{group-id\}]/groups/'
--

Lists the direct subgroups of a group.

As result a list of link:#group-info[GroupInfo] entries is returned.
The entries in the list are sorted by group name and UUID.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/groups/ HTTP/1.0
----

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  [
    {
      "id": "7ca042f4d5847936fcb90ca91057673157fd06fc",
      "name": "MyProject-Verifiers",
      "url": "#/admin/groups/uuid-7ca042f4d5847936fcb90ca91057673157fd06fc",
      "options": {
      },
      "group_id": 38,
      "owner": "MyProject-Verifiers",
      "owner_id": "7ca042f4d5847936fcb90ca91057673157fd06fc",
      "created_on": "2013-02-01 09:59:32.126000000"
    }
  ]
----

[[get-subgroup]]
=== Get Subgroup
--
'GET /groups/link:#group-id[\{group-id\}]/groups/link:#group-id[\{group-id\}]'
--

Retrieves a subgroup.

.Request
----
  GET /groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/groups/7ca042f4d5847936fcb90ca91057673157fd06fc HTTP/1.0
----

As response a link:#group-info[GroupInfo] entity is returned that
describes the subgroup.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "id": "7ca042f4d5847936fcb90ca91057673157fd06fc",
    "name": "MyProject-Verifiers",
    "url": "#/admin/groups/uuid-7ca042f4d5847936fcb90ca91057673157fd06fc",
    "options": {
    },
    "group_id": 38,
    "owner": "Administrators",
    "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "created_on": "2013-02-01 09:59:32.126000000"
  }
----

[[add-subgroup]]
=== Add Subgroup
--
'PUT /groups/link:#group-id[\{group-id\}]/groups/link:#group-id[\{group-id\}]'
--

Adds an internal or external group as subgroup to a Gerrit internal group.
External groups must be specified using the UUID.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  PUT /groups/MyProject-Committers/groups/MyGroup HTTP/1.0
----

As response a link:#group-info[GroupInfo] entity is returned that
describes the subgroup.

.Response
----
  HTTP/1.1 201 Created
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "name": "MyGroup",
    "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "options": {
    },
    "group_id": 8,
    "owner": "Administrators",
    "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
    "created_on": "2013-02-01 09:59:32.126000000"
  }
----

The request also succeeds if the group is already a subgroup of this
group.

[[add-subgroups]]
=== Add Subgroups
--
'POST /groups/link:#group-id[\{group-id\}]/groups'
--

OR

--
'POST /groups/link:#group-id[\{group-id\}]/groups.add'
--

Adds one or several groups as subgroups to a Gerrit internal group.

The subgroups to be added must be provided in the request body as a
link:#groups-input[GroupsInput] entity.

.Request
----
  POST /groups/MyProject-Committers/groups.add HTTP/1.0
  Content-Type: application/json; charset=UTF-8

  {
    "groups": [
      "MyGroup",
      "MyOtherGroup"
    ]
  }
----

As response a list of link:#group-info[GroupInfo] entities is
returned that describes the groups that were specified in the
link:#groups-input[GroupsInput]. A link:#group-info[GroupInfo] entity
is returned for each group specified in the input, independently of
whether the group was newly added as subgroup or whether the
group was already a subgroup of the group.

.Response
----
  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  [
    {
      "id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "name": "MyGroup",
      "url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "options": {
      },
      "group_id": 8,
      "owner": "Administrators",
      "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
      "created_on": "2013-02-01 09:59:32.126000000"
    },
    {
      "id": "5057f3cbd3519d6ab69364429a89ffdffba50f73",
      "name": "MyOtherGroup",
      "url": "#/admin/groups/uuid-5057f3cbd3519d6ab69364429a89ffdffba50f73",
      "options": {
      },
      "group_id": 10,
      "owner": "MyOtherGroup",
      "owner_id": "5057f3cbd3519d6ab69364429a89ffdffba50f73",
      "created_on": "2013-02-01 09:59:32.126000000"
    }
  ]
----

[[remove-subgroup]]
=== Remove Subgroup
--
'DELETE /groups/link:#group-id[\{group-id\}]/groups/link:#group-id[\{group-id\}]'
--

Removes a subgroup from a Gerrit internal group.

This endpoint is only allowed for Gerrit internal groups; attempting to call on a
non-internal group will return 405 Method Not Allowed.

.Request
----
  DELETE /groups/MyProject-Committers/groups/MyGroup HTTP/1.0
----

.Response
----
  HTTP/1.1 204 No Content
----

[[remove-subgroups]]
=== Remove Subgroups
--
'POST /groups/link:#group-id[\{group-id\}]/groups.delete'
--

Removes one or several subgroups from a Gerrit internal group.

The subgroups to be removed must be provided in the request body as a
link:#groups-input[GroupsInput] entity.

.Request
----
  POST /groups/MyProject-Committers/groups.delete HTTP/1.0
  Content-Type: application/json; charset=UTF-8

  {
    "groups": [
      "MyGroup",
      "MyOtherGroup"
    ]
  }
----

.Response
----
  HTTP/1.1 204 No Content
----


[[ids]]
== IDs

[[group-id]]
=== \{group-id\}
Identifier for a group.

This can be:

* the UUID of the group
* the legacy numeric ID of the group
* the name of the group if it is unique

[[group-name]]
=== \{group-name\}
Group name that uniquely identifies one group.


[[json-entities]]
== JSON Entities

[[group-audit-event-info]]
=== GroupAuditEventInfo
The `GroupAuditEventInfo` entity contains information about an audit
event of a group.

[options="header",cols="1,6"]
|======================
|Field Name|Description
|`member`  |
The group member that is added/removed. If `type` is `ADD_USER` or
`REMOVE_USER` the member is returned as detailed
link:rest-api-accounts.html#account-info[AccountInfo] entity, if `type`
is `ADD_GROUP` or `REMOVE_GROUP` the member is returned as
link:#group-info[GroupInfo] entity. Note that the `name` in
link:#group-info[GroupInfo] will not be set if the member group is not
available.
|`type`    |
The event type, can be: `ADD_USER`, `REMOVE_USER`, `ADD_GROUP` or
`REMOVE_GROUP`.

`ADD_USER`: A user was added as member to the group.

`REMOVE_USER`: A user member was removed from the group.

`ADD_GROUP`: A group was included as member in the group.

`REMOVE_GROUP`: An included group was removed from the group.
|`user`    |
The user that did the add/remove as detailed
link:rest-api-accounts.html#account-info[AccountInfo] entity.
|`date`    |
The timestamp of the event.
|======================

[[group-info]]
=== GroupInfo
The `GroupInfo` entity contains information about a group. This can be
a Gerrit internal group, or an external group that is known to Gerrit.

[options="header",cols="1,^1,5"]
|===========================
|Field Name    ||Description
|`id`          ||The URL encoded UUID of the group.
|`name`        |
optional, not set if returned in a map where the group name is used as map key|
The name of the group. +
For external groups the group name is missing if there is no group
backend that can resolve the group UUID. E.g. this can happen when a
plugin that provided a group backend was uninstalled.
|`url`         |optional|
URL to information about the group. Typically a URL to a web page that
permits users to apply to join the group, or manage their membership.
|`options`     ||link:#group-options-info[Options of the group]
|`description` |only for internal groups|The description of the group.
|`group_id`    |only for internal groups|The numeric ID of the group.
|`owner`       |only for internal groups|The name of the owner group.
|`owner_id`    |only for internal groups|The URL encoded UUID of the owner group.
|`created_on`  |only for internal groups|The
link:rest-api.html#timestamp[timestamp] of when the group was created.
|`_more_groups`|optional, only for internal groups, not set if `false`|
Whether the query would deliver more results if not limited. +
Only set on the last group that is returned by a
link:#query-groups[group query].
|`members`     |optional, only for internal groups|
A list of link:rest-api-accounts.html#account-info[AccountInfo]
entities describing the direct members. +
Only set if link:#members[members] are requested.
|`includes`    |optional, only for internal groups|
A list of link:#group-info[GroupInfo] entities describing the direct
subgroups. +
Only set if link:#includes[subgroups] are requested.
|===========================

The type of a group can be deduced from the group's UUID:
|============
|UUID matches "^[0-9a-f]\{40\}$"|Gerrit internal group
|UUID starts with "global:"|Gerrit system group
|UUID starts with "ldap:"|LDAP group
|UUID starts with "<prefix>:"|other external group
|============

[[group-input]]
=== GroupInput
The 'GroupInput' entity contains information for the creation of
a new internal group.

[options="header",cols="1,^1,5"]
|===========================
|Field Name      ||Description
|`name`          |optional|The name of the group (not encoded). +
If set, must match the group name in the URL.
|`description`   |optional|The description of the group.
|`visible_to_all`|optional|
Whether the group is visible to all registered users. +
`false` if not set.
|`owner_id`      |optional|The URL encoded ID of the owner group. +
This can be a group UUID, a legacy numeric group ID or a unique group
name. +
If not set, the new group will be self-owned.
|`members`       |optional|The initial members in a list of +
link:rest-api-accounts.html#account-id[account ids].
|===========================

[[group-options-info]]
=== GroupOptionsInfo
Options of the group.

[options="header",cols="1,^1,5"]
|=============================
|Field Name      ||Description
|`visible_to_all`|not set if `false`|
Whether the group is visible to all registered users.
|=============================

[[group-options-input]]
=== GroupOptionsInput
New options for a group.

[options="header",cols="1,^1,5"]
|=============================
|Field Name      ||Description
|`visible_to_all`|not set if `false`|
Whether the group is visible to all registered users.
|=============================

[[groups-input]]
=== GroupsInput
The `GroupsInput` entity contains information about groups that should
be included into a group or that should be deleted from a group.

[options="header",cols="1,^1,5"]
|==========================
|Field Name   ||Description
|`_one_group` |optional|
The link:#group-id[id] of one group that should be included or deleted.
|`groups`     |optional|
A list of link:#group-id[group ids] that identify the groups that
should be included or deleted.
|==========================

[[members-input]]
=== MembersInput
The `MembersInput` entity contains information about accounts that should
be added as members to a group or that should be deleted from the group.

[options="header",cols="1,^1,5"]
|==========================
|Field Name   ||Description
|`_one_member`|optional|
The link:rest-api-accounts.html#account-id[id] of one account that
should be added or deleted.
|`members`    |optional|
A list of link:rest-api-accounts.html#account-id[account ids] that
identify the accounts that should be added or deleted.
|==========================


GERRIT
------
Part of link:index.html[Gerrit Code Review]

SEARCHBOX
---------