Skip to main content

groups

Creates, updates, deletes, gets or lists a groups resource.

Overview

Namegroups
TypeResource
Idgoogleadmin.directory.groups

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstringRead-only. The unique ID of a group. A group id can be used as a group request URI's groupKey.
namestringThe group's display name.
adminCreatedbooleanRead-only. Value is true if this group was created by an administrator rather than a user.
aliasesarrayRead-only. The list of a group's alias email addresses. To add, update, or remove a group's aliases, use the groups.aliases methods. If edited in a group's POST or PUT request, the edit is ignored.
descriptionstringAn extended description to help users determine the purpose of a group. For example, you can include information about who should join the group, the types of messages to send to the group, links to FAQs about the group, or related groups. Maximum length is 4,096 characters.
directMembersCountstring (int64)The number of users that are direct members of the group. If a group is a member (child) of this group (the parent), members of the child group are not counted in the directMembersCount property of the parent group.
emailstringThe group's email address. If your account has multiple domains, select the appropriate domain for the email address. The email must be unique. This property is required when creating a group. Group email addresses are subject to the same character usage rules as usernames, see the help center for details.
etagstringETag of the resource.
kindstringThe type of the API resource. For Groups resources, the value is admin#directory#group. (default: admin#directory#group)
nonEditableAliasesarrayRead-only. The list of the group's non-editable alias email addresses that are outside of the account's primary domain or subdomains. These are functioning email addresses used by the group. This is a read-only property returned in the API's response for a group. If edited in a group's POST or PUT request, the edit is ignored.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectgroupKeyRetrieves a group's properties.
listselectdomaincustomer, maxResults, orderBy, pageToken, query, sortOrder, userKeyRetrieves all groups of a domain or of a user given a userKey (paginated).
insertinsertCreates a group.
patchupdategroupKeyUpdates a group's properties. This method supports patch semantics.
updatereplacegroupKeyUpdates a group's properties.
deletedeletegroupKeyDeletes a group.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
domainstring
groupKeystring
customerstring
maxResultsinteger (int32)
orderBystring
pageTokenstring
querystring
sortOrderstring
userKeystring

SELECT examples

Retrieves a group's properties.

SELECT
id,
name,
adminCreated,
aliases,
description,
directMembersCount,
email,
etag,
kind,
nonEditableAliases
FROM googleadmin.directory.groups
WHERE groupKey = '{{ groupKey }}' -- required;

INSERT examples

Creates a group.

INSERT INTO googleadmin.directory.groups (
data__id,
data__email,
data__name,
data__description,
data__adminCreated,
data__directMembersCount,
data__kind,
data__etag,
data__aliases,
data__nonEditableAliases
)
SELECT
'{{ id }}',
'{{ email }}',
'{{ name }}',
'{{ description }}',
{{ adminCreated }},
'{{ directMembersCount }}',
'{{ kind }}',
'{{ etag }}',
'{{ aliases }}',
'{{ nonEditableAliases }}'
RETURNING
id,
name,
adminCreated,
aliases,
description,
directMembersCount,
email,
etag,
kind,
nonEditableAliases
;

UPDATE examples

Updates a group's properties. This method supports patch semantics.

UPDATE googleadmin.directory.groups
SET
data__id = '{{ id }}',
data__email = '{{ email }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__adminCreated = {{ adminCreated }},
data__directMembersCount = '{{ directMembersCount }}',
data__kind = '{{ kind }}',
data__etag = '{{ etag }}',
data__aliases = '{{ aliases }}',
data__nonEditableAliases = '{{ nonEditableAliases }}'
WHERE
groupKey = '{{ groupKey }}' --required
RETURNING
id,
name,
adminCreated,
aliases,
description,
directMembersCount,
email,
etag,
kind,
nonEditableAliases;

REPLACE examples

Updates a group's properties.

REPLACE googleadmin.directory.groups
SET
data__id = '{{ id }}',
data__email = '{{ email }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__adminCreated = {{ adminCreated }},
data__directMembersCount = '{{ directMembersCount }}',
data__kind = '{{ kind }}',
data__etag = '{{ etag }}',
data__aliases = '{{ aliases }}',
data__nonEditableAliases = '{{ nonEditableAliases }}'
WHERE
groupKey = '{{ groupKey }}' --required
RETURNING
id,
name,
adminCreated,
aliases,
description,
directMembersCount,
email,
etag,
kind,
nonEditableAliases;

DELETE examples

Deletes a group.

DELETE FROM googleadmin.directory.groups
WHERE groupKey = '{{ groupKey }}' --required;