Drive and Photo Service provides group management in its default client. Call the API operations in this topic to manage groups.
Basic concepts
A group can represent an enterprise department. A group can contain users or other groups.
The members of a group can be users or groups.
The following figure shows the structure of a sample enterprise.

A user can be added to multiple groups. Add a user to no more than ten groups. Otherwise, query performance can degrade.
Specify a parent group when you create a group. A group cannot be moved after creation. If you do not specify a parent group, the new group becomes a root group.
A group can have a maximum of 10 levels.
Sample API calls
1. Create a group
To create a root group, set the is_root parameter to true. To create a non-root group, specify the parent_group_id parameter and set the is_root parameter to false.
Sample request
// Create a root group.
{
"group_name": "Enterprise A",
"is_root": true
}
// Create an R&D department in Enterprise A.
{
"group_name": "R&D department",
"is_root": false,
"parent_group_id": "testParentGroupId"
}Sample success response
{
"domain_id": "testDomainId",
"group_id": "testGroupId",
"group_name": "testGroupName",
"description": "",
"created_at": 1677335855709,
"updated_at": 1677335855709,
"creator": "",
"permission": null
}2. List group members
To list all root groups, do not specify the group_id parameter.
Sample request
{
"group_id": "testGroupId",
"limit": 100
}Sample success response
{
"group_items": [
{
"domain_id": "testDomainId",
"group_id": "testGroupId",
"group_name": "R&D department",
"description": "",
"created_at": 1677336367210,
"updated_at": 1677336367210,
"creator": "",
"permission": null
}
],
"user_items": [],
"next_marker": ""3. Add a user to a group
Use this operation to add users to groups only. To add a group to a parent group, specify the parent_group_id parameter when you create the child group.
Sample request
{
"group_id": "testGroupId",
"member_id": "testMemberId",
"member_type": "user"
}Sample response
204 NoContent4. Remove a user from a group
Use this operation to remove users from groups only. To delete a group, first remove all members and then delete the group.
Sample request
{
"group_id": "testGroupId",
"member_id": "testMemberId",
"member_type": "user"
}Sample response
204 NoContent5. Delete a group
This operation deletes only groups that have no members.
Sample request
{
"group_id": "testGroupId"
}Sample response
204 NoContent