Skip to main content

members

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

Overview

Namemembers
TypeResource
Idgoogleadmin.directory.members

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstringThe unique ID of the group member. A member id can be used as a member request URI's memberKey.
delivery_settingsstringDefines mail delivery preferences of member. This field is only supported by insert, update, and get methods.
emailstringThe member's email address. A member can be a user or another group. This property is required when adding a member to a group. The email must be unique and cannot be an alias of another group. If the email address is changed, the API automatically reflects the email address changes.
etagstringETag of the resource.
kindstringThe type of the API resource. For Members resources, the value is admin#directory#member. (default: admin#directory#member)
rolestringThe member's role in a group. The API returns an error for cycles in group memberships. For example, if group1 is a member of group2, group2 cannot be a member of group1. For more information about a member's role, see the administration help center.
statusstringStatus of member (Immutable)
typestringThe type of group member.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectgroupKey, memberKeyRetrieves a group member's properties.
listselectgroupKeyincludeDerivedMembership, maxResults, pageToken, rolesRetrieves a paginated list of all members in a group. This method times out after 60 minutes. For more information, see Troubleshoot error codes.
insertinsertgroupKeyAdds a user to the specified group.
patchupdategroupKey, memberKeyUpdates the membership properties of a user in the specified group. This method supports patch semantics.
updatereplacegroupKey, memberKeyUpdates the membership of a user in the specified group.
deletedeletegroupKey, memberKeyRemoves a member from a group.
has_memberexecgroupKey, memberKeyChecks whether the given user is a member of the group. Membership can be direct or nested, but if nested, the memberKey and groupKey must be entities in the same domain or an Invalid input error is returned. To check for nested memberships that include entities outside of the group's domain, use the checkTransitiveMembership() method in the Cloud Identity Groups API.

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
groupKeystring
memberKeystring
includeDerivedMembershipboolean
maxResultsinteger (int32)
pageTokenstring
rolesstring

SELECT examples

Retrieves a group member's properties.

SELECT
id,
delivery_settings,
email,
etag,
kind,
role,
status,
type
FROM googleadmin.directory.members
WHERE groupKey = '{{ groupKey }}' -- required
AND memberKey = '{{ memberKey }}' -- required;

INSERT examples

Adds a user to the specified group.

INSERT INTO googleadmin.directory.members (
data__kind,
data__email,
data__role,
data__etag,
data__type,
data__status,
data__delivery_settings,
data__id,
groupKey
)
SELECT
'{{ kind }}',
'{{ email }}',
'{{ role }}',
'{{ etag }}',
'{{ type }}',
'{{ status }}',
'{{ delivery_settings }}',
'{{ id }}',
'{{ groupKey }}'
RETURNING
id,
delivery_settings,
email,
etag,
kind,
role,
status,
type
;

UPDATE examples

Updates the membership properties of a user in the specified group. This method supports patch semantics.

UPDATE googleadmin.directory.members
SET
data__kind = '{{ kind }}',
data__email = '{{ email }}',
data__role = '{{ role }}',
data__etag = '{{ etag }}',
data__type = '{{ type }}',
data__status = '{{ status }}',
data__delivery_settings = '{{ delivery_settings }}',
data__id = '{{ id }}'
WHERE
groupKey = '{{ groupKey }}' --required
AND memberKey = '{{ memberKey }}' --required
RETURNING
id,
delivery_settings,
email,
etag,
kind,
role,
status,
type;

REPLACE examples

Updates the membership of a user in the specified group.

REPLACE googleadmin.directory.members
SET
data__kind = '{{ kind }}',
data__email = '{{ email }}',
data__role = '{{ role }}',
data__etag = '{{ etag }}',
data__type = '{{ type }}',
data__status = '{{ status }}',
data__delivery_settings = '{{ delivery_settings }}',
data__id = '{{ id }}'
WHERE
groupKey = '{{ groupKey }}' --required
AND memberKey = '{{ memberKey }}' --required
RETURNING
id,
delivery_settings,
email,
etag,
kind,
role,
status,
type;

DELETE examples

Removes a member from a group.

DELETE FROM googleadmin.directory.members
WHERE groupKey = '{{ groupKey }}' --required
AND memberKey = '{{ memberKey }}' --required;

Lifecycle Methods

Checks whether the given user is a member of the group. Membership can be direct or nested, but if nested, the memberKey and groupKey must be entities in the same domain or an Invalid input error is returned. To check for nested memberships that include entities outside of the group's domain, use the checkTransitiveMembership() method in the Cloud Identity Groups API.

EXEC googleadmin.directory.members.has_member 
@groupKey='{{ groupKey }}' --required,
@memberKey='{{ memberKey }}' --required;