Method: mediaItems.list

  • Retrieves a list of media items selected by a user during a specific Photos Picker session.

  • Requires providing the session ID as a query parameter in the GET request.

  • Supports pagination to retrieve large lists of media items.

  • Returns an error if the user has not finished picking media items, prompting the application to poll until the session is ready.

  • Requires authorization with the https://www.googleapis.com/auth/photospicker.mediaitems.readonly scope.

Returns a list of media items picked by the user during the specified session.

A FAILED_PRECONDITION error is returned if the user has not yet finished picking media items for the specified session. In this scenario, your application should poll sessions.get until the session is ready before retrying this method.

HTTP request

GET https://photospicker.googleapis.com/v1/mediaItems

The URL uses gRPC Transcoding syntax.

Query parameters

Parameters
sessionId

string

Required. The Google-generated identifier for this session.

pageSize

integer

Optional. The maximum number of media items to return.

The service may return fewer than this value (including zero results). If unspecified or set to 0, at most 50 media items is returned. The maximum value is 100; values above 100 will be coerced to 100. Negative values will result in an INVALID_ARGUMENT error.

pageToken

string

Optional. A page token, received from a previous mediaItems.list call. Provide this to retrieve the subsequent page.

Request body

The request body must be empty.

Response body

Response to the mediaItems.list method.

If successful, the response body contains data with the following structure:

JSON representation
{
  "mediaItems": [
    {
      object (PickedMediaItem)
    }
  ],
  "nextPageToken": string
}
Fields
mediaItems[]

object (PickedMediaItem)

A page of picked media items.

nextPageToken

string

If set, this field can be used as the pageToken in a subsequent mediaItems.list call to retrieve the next page of picked media items.

If this field is omitted, there are no subsequent pages.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/photospicker.mediaitems.readonly