Skip to main content

photos

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

Overview

Namephotos
TypeResource
Idgoogleadmin.directory.photos

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstringThe ID the API uses to uniquely identify the user.
etagstringETag of the resource.
heightinteger (int32)Height of the photo in pixels.
kindstringThe type of the API resource. For Photo resources, this is admin#directory#user#photo. (default: admin#directory#user#photo)
mimeTypestringThe MIME type of the photo. Allowed values are JPEG, PNG, GIF, BMP, TIFF, and web-safe base64 encoding.
photoDatastring (byte)The user photo's upload data in web-safe Base64 format in bytes. This means: * The slash (/) character is replaced with the underscore (_) character. * The plus sign (+) character is replaced with the hyphen (-) character. * The equals sign (=) character is replaced with the asterisk (*). * For padding, the period (.) character is used instead of the RFC-4648 baseURL definition which uses the equals sign (=) for padding. This is done to simplify URL-parsing. * Whatever the size of the photo being uploaded, the API downsizes it to 96x96 pixels.
primaryEmailstringThe user's primary email address.
widthinteger (int32)Width of the photo in pixels.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectuserKeyRetrieves the user's photo.
patchupdateuserKeyAdds a photo for the user. This method supports patch semantics.
updatereplaceuserKeyAdds a photo for the user.
deletedeleteuserKeyRemoves the user's photo.

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
userKeystring

SELECT examples

Retrieves the user's photo.

SELECT
id,
etag,
height,
kind,
mimeType,
photoData,
primaryEmail,
width
FROM googleadmin.directory.photos
WHERE userKey = '{{ userKey }}' -- required;

UPDATE examples

Adds a photo for the user. This method supports patch semantics.

UPDATE googleadmin.directory.photos
SET
data__id = '{{ id }}',
data__primaryEmail = '{{ primaryEmail }}',
data__kind = '{{ kind }}',
data__etag = '{{ etag }}',
data__photoData = '{{ photoData }}',
data__mimeType = '{{ mimeType }}',
data__width = {{ width }},
data__height = {{ height }}
WHERE
userKey = '{{ userKey }}' --required
RETURNING
id,
etag,
height,
kind,
mimeType,
photoData,
primaryEmail,
width;

REPLACE examples

Adds a photo for the user.

REPLACE googleadmin.directory.photos
SET
data__id = '{{ id }}',
data__primaryEmail = '{{ primaryEmail }}',
data__kind = '{{ kind }}',
data__etag = '{{ etag }}',
data__photoData = '{{ photoData }}',
data__mimeType = '{{ mimeType }}',
data__width = {{ width }},
data__height = {{ height }}
WHERE
userKey = '{{ userKey }}' --required
RETURNING
id,
etag,
height,
kind,
mimeType,
photoData,
primaryEmail,
width;

DELETE examples

Removes the user's photo.

DELETE FROM googleadmin.directory.photos
WHERE userKey = '{{ userKey }}' --required;