了解新的 Picker API 和重要的 Library API 变更。如需了解详情,请点击
此处。
Method: mediaItems.list
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):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`"]]