瞭解新的 Picker API 和 Library API 的重要異動。詳情請參閱
本文。
Method: mediaItems.list
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eRetrieves a list of media items selected by a user during a specific Photos Picker session.\u003c/p\u003e\n"],["\u003cp\u003eRequires providing the session ID as a query parameter in the GET request.\u003c/p\u003e\n"],["\u003cp\u003eSupports pagination to retrieve large lists of media items.\u003c/p\u003e\n"],["\u003cp\u003eReturns an error if the user has not finished picking media items, prompting the application to poll until the session is ready.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with the \u003ccode\u003ehttps://www.googleapis.com/auth/photospicker.mediaitems.readonly\u003c/code\u003e scope.\u003c/p\u003e\n"]]],["This describes retrieving a list of media items selected by a user within a specific session. A `GET` request to `https://photospicker.googleapis.com/v1/mediaItems` is used, with the `sessionId` as a required query parameter. Optional parameters include `pageSize` (max 100) and `pageToken` for pagination. The request body must be empty. A successful response includes an array of `mediaItems` and optionally a `nextPageToken`. If the session is incomplete, a `FAILED_PRECONDITION` error is returned, requiring polling. The authorization scope `https://www.googleapis.com/auth/photospicker.mediaitems.readonly` is needed.\n"],null,["# Method: mediaItems.list\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ListMediaItemsResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n\nReturns a list of media items picked by the user during the specified session.\n\nA `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.\n\n### HTTP request\n\n`GET https://photospicker.googleapis.com/v1/mediaItems`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `sessionId` | `string` Required. The Google-generated identifier for this session. |\n| `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. |\n| `pageToken` | `string` Optional. A page token, received from a previous `mediaItems.list` call. Provide this to retrieve the subsequent page. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nResponse to the `mediaItems.list` method.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"mediaItems\": [ { object (/photos/picker/reference/rest/v1/mediaItems#PickedMediaItem) } ], \"nextPageToken\": string } ``` |\n\n| Fields ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `mediaItems[]` | `object (`[PickedMediaItem](/photos/picker/reference/rest/v1/mediaItems#PickedMediaItem)`)` A page of picked media items. |\n| `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. |\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/photospicker.mediaitems.readonly`"]]