# REST Resource: mediaItems

- [Resource: MediaItem](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#MediaItem)
  - [JSON representation](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#MediaItem.SCHEMA_REPRESENTATION)
- [MediaMetadata](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#MediaMetadata)
  - [JSON representation](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#MediaMetadata.SCHEMA_REPRESENTATION)
- [Photo](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#Photo)
  - [JSON representation](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#Photo.SCHEMA_REPRESENTATION)
- [Video](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#Video)
  - [JSON representation](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#Video.SCHEMA_REPRESENTATION)
- [VideoProcessingStatus](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#VideoProcessingStatus)
- [ContributorInfo](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#ContributorInfo)
  - [JSON representation](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#ContributorInfo.SCHEMA_REPRESENTATION)
- [Methods](https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#METHODS_SUMMARY)

## 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 (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#MediaMetadata`) }, "contributorInfo": { object (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#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. Must be shorter than 1000 characters. Only include text written by users. Descriptions should add context and help users understand media. Do not include any auto-generated strings such as filenames, tags, and other metadata. |
| `productUrl` | `string` Google Photos URL for the media item. This link is available to the user only if they're signed in. When retrieved from an album search, the URL points to the item inside the album. |
| `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](https://developers.google.com/photos/library/guides/access-media-items#base-urls) 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 (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#MediaMetadata`)`` Metadata related to the media item, such as, height, width, or creation time. |
| `contributorInfo` | ``object (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#ContributorInfo`)`` Information about the user who added this media item. Note that this is only included when using `https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems/search#google.photos.library.v1.PhotosLibrary.SearchMediaItems` with the ID of a shared album. The album must be created by your app and you must have the sharing scope. |
| `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 (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#Photo`) }, "video": { object (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#Video`) } // End of list of possible types for union field `metadata`. } ``` |

| Fields ||
|---|---|
| `creationTime` | ``string (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.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, with nanosecond resolution and up to nine fractional digits. Examples: `"2014-10-02T15:01:23Z"` and `"2014-10-02T15:01:23.045123456Z"`. |
| `width` | `string (https://developers.google.com/discovery/v1/type-format format)` Original width (in pixels) of the media item. |
| `height` | `string (https://developers.google.com/discovery/v1/type-format 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 (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#Photo`)`` Metadata for a photo media type. |
| `video` | ``object (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#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": integer, "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` | `integer` ISO of the camera with which the photo was taken. |
| `exposureTime` | ``string (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration` format)`` Exposure time of the camera aperture when the photo was taken. A duration in seconds with up to nine fractional digits, ending with '`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 (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#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 (`https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems#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. Important: attempting to download a video not in the READY state may fail. |
| `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 ||
|---|---|
| ### `https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems/batchCreate` | Creates one or more media items in a user's Google Photos library. |
| ### `https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems/batchGet` | Returns the list of media items for the specified media item identifiers. |
| ### `https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems/get` | Returns the media item for the specified media item identifier. |
| ### `https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems/list` | List all media items from a user's Google Photos library. |
| ### `https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems/patch` | Update the media item with the specified `id`. |
| ### `https://developers.google.com/photos/library/legacy/reference/rest/v1/mediaItems/search` | Searches for media items in a user's Google Photos library. |