คุณกำลังดูเอกสารประกอบเดิมสำหรับ Google Photos Library API
Method: mediaItems.list
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThis API endpoint lists media items from a user's Google Photos library using a GET request to \u003ccode\u003ehttps://photoslibrary.googleapis.com/v1/mediaItems\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eUsers can control the number of items and pagination through \u003ccode\u003epageSize\u003c/code\u003e and \u003ccode\u003epageToken\u003c/code\u003e query parameters.\u003c/p\u003e\n"],["\u003cp\u003eThe response includes a list of media items and a token for retrieving subsequent pages if available.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization requires an OAuth scope with appropriate permissions for accessing the user's photos library.\u003c/p\u003e\n"]]],["To list media items from a Google Photos library, send a `GET` request to `https://photoslibrary.googleapis.com/v1/mediaItems`. The request body must be empty. Use `pageSize` to control the number of results (default 25, max 100) and `pageToken` for pagination. The response will contain a `mediaItems` array and `nextPageToken` for subsequent requests. Authorization requires specific OAuth scopes: `photoslibrary`, `photoslibrary.readonly`, or `photoslibrary.readonly.appcreateddata`.\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- [Try it!](#try-it)\n\nList all media items from a user's Google Photos library.\n\n### HTTP request\n\n`GET https://photoslibrary.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| `pageSize` | `integer` Maximum number of media items to return in the response. Fewer media items might be returned than the specified number. The default `pageSize` is 25, the maximum is 100. |\n| `pageToken` | `string` A continuation token to get the next page of the results. Adding this to the request returns the rows after the `pageToken`. The `pageToken` should be the value returned in the `nextPageToken` parameter in the response to the `listMediaItems` request. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nList of all media items from the user's Google Photos library.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"mediaItems\": [ { object (/photos/library/legacy/reference/rest/v1/mediaItems#MediaItem) } ], \"nextPageToken\": string } ``` |\n\n| Fields ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `mediaItems[]` | `object (`[MediaItem](/photos/library/legacy/reference/rest/v1/mediaItems#MediaItem)`)` Output only. List of media items in the user's library. |\n| `nextPageToken` | `string` Output only. Token to use to get the next set of media items. Its presence is the only reliable indicator of more media items being available in the next request. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/photoslibrary`\n- `\n https://www.googleapis.com/auth/photoslibrary.readonly`\n- `\n https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata`"]]