REST Resource: mediaItems

Resource: MediaItem

Representation of a media item (such as a photo or video) in Google Photos.

JSON representation
{
  "id": string,
  "description": string,
  "productUrl": string,
  "baseUrl": string,
  "mimeType": string,
  "mediaMetadata": {
    object (MediaMetadata)
  },
  "contributorInfo": {
    object (ContributorInfo)
  },
  "filename": string
}
Fields
id

string

Identifier for the media item. This is a persistent identifier that can be used between sessions to identify this media item.

description

string

Description of the media item. This is shown to the user in the item's info section in the Google Photos app.

productUrl

string

Google Photos URL for the media item. This link is available to the user only if they're signed in.

baseUrl

string

A URL to the media item's bytes. This shouldn't be used as is. Parameters should be appended to this URL before use. See the developer documentation for a complete list of supported parameters. For example, '=w2048-h1024' will set the dimensions of a media item of type photo to have a width of 2048 px and height of 1024 px.

mimeType

string

MIME type of the media item. For example, image/jpeg.

mediaMetadata

object (MediaMetadata)

Metadata related to the media item, such as, height, width, or creation time.

contributorInfo

object (ContributorInfo)

Information about the user who created this media item.

filename

string

Filename of the media item. This is shown to the user in the item's info section in the Google Photos app.

MediaMetadata

Metadata for a media item.

JSON representation
{
  "creationTime": string,
  "width": string,
  "height": string,

  // Union field metadata can be only one of the following:
  "photo": {
    object (Photo)
  },
  "video": {
    object (Video)
  }
  // End of list of possible types for union field metadata.
}
Fields
creationTime

string (Timestamp format)

Time when the media item was first created (not when it was uploaded to Google Photos).

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

width

string (int64 format)

Original width (in pixels) of the media item.

height

string (int64 format)

Original height (in pixels) of the media item.

Union field metadata. Metadata for the media item specific to the underlying media type it represents. metadata can be only one of the following:
photo

object (Photo)

Metadata for a photo media type.

video

object (Video)

Metadata for a video media type.

Photo

Metadata that is specific to a photo, such as, ISO, focal length and exposure time. Some of these fields may be null or not included.

JSON representation
{
  "cameraMake": string,
  "cameraModel": string,
  "focalLength": number,
  "apertureFNumber": number,
  "isoEquivalent": number,
  "exposureTime": string
}
Fields
cameraMake

string

Brand of the camera with which the photo was taken.

cameraModel

string

Model of the camera with which the photo was taken.

focalLength

number

Focal length of the camera lens with which the photo was taken.

apertureFNumber

number

Aperture f number of the camera lens with which the photo was taken.

isoEquivalent

number

ISO of the camera with which the photo was taken.

exposureTime

string (Duration format)

Exposure time of the camera aperture when the photo was taken.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

Video

Metadata that is specific to a video, for example, fps and processing status. Some of these fields may be null or not included.

JSON representation
{
  "cameraMake": string,
  "cameraModel": string,
  "fps": number,
  "status": enum (VideoProcessingStatus)
}
Fields
cameraMake

string

Brand of the camera with which the video was taken.

cameraModel

string

Model of the camera with which the video was taken.

fps

number

Frame rate of the video.

status

enum (VideoProcessingStatus)

Processing status of the video.

VideoProcessingStatus

Processing status of a video being uploaded to Google Photos.

Enums
UNSPECIFIED Video processing status is unknown.
PROCESSING Video is being processed. The user sees an icon for this video in the Google Photos app; however, it isn't playable yet.
READY Video processing is complete and it is now ready for viewing.
FAILED Something has gone wrong and the video has failed to process.

ContributorInfo

Information about the user who added the media item. Note that this information is included only if the media item is within a shared album created by your app and you have the sharing scope.

JSON representation
{
  "profilePictureBaseUrl": string,
  "displayName": string
}
Fields
profilePictureBaseUrl

string

URL to the profile picture of the contributor.

displayName

string

Display name of the contributor.

Methods

batchCreate

Creates one or more media items in a user's Google Photos library.

batchGet

Returns the list of media items for the specified media item identifiers.

get

Returns the media item for the specified media item identifier.

list

List all media items from a user's Google Photos library.

search

Searches for media items in a user's Google Photos library.