Bạn đang xem tài liệu cũ về API Thư viện Google Photos.
Method: albums.list
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Liệt kê tất cả album hiển thị cho người dùng trong thẻ Album của ứng dụng Google Photos.
Yêu cầu HTTP
GET https://photoslibrary.googleapis.com/v1/albums
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số truy vấn
Thông số |
pageSize |
integer
Số album tối đa cần trả lại trong phản hồi. Có thể trả về ít anbom hơn so với số lượng đã chỉ định. pageSize mặc định là 20, tối đa là 50.
|
pageToken |
string
Mã thông báo tiếp tục để xem trang kết quả tiếp theo. Việc thêm thông tin này vào yêu cầu sẽ trả về các hàng sau pageToken . pageToken phải là giá trị được trả về trong tham số nextPageToken khi phản hồi yêu cầu listAlbums .
|
excludeNonAppCreatedData |
boolean
Nếu bạn đặt chính sách này, kết quả sẽ loại trừ những mục nội dung nghe nhìn không phải do ứng dụng này tạo ra. Giá trị mặc định là false (tất cả album đều được trả về). Trường này sẽ bị bỏ qua nếu bạn sử dụng phạm vi photoslibrary.readonly.app tạodata.
|
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Danh sách album đã yêu cầu.
Nếu thành công, phần nội dung phản hồi sẽ chứa dữ liệu có cấu trúc sau:
Biểu diễn dưới dạng JSON |
{
"albums": [
{
object (Album )
}
],
"nextPageToken": string
} |
Trường |
albums[] |
object (Album )
Chỉ có đầu ra. Danh sách album xuất hiện trong thẻ Album của ứng dụng Google Photos của người dùng.
|
nextPageToken |
string
Chỉ có đầu ra. Mã thông báo dùng để tải tập hợp album tiếp theo. Được điền nếu có thêm album cần truy xuất cho yêu cầu này.
|
Phạm vi uỷ quyền
Yêu cầu một trong các phạm vi OAuth sau:
https://www.googleapis.com/auth/photoslibrary
https://www.googleapis.com/auth/photoslibrary.readonly
https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003eLists all albums displayed in the user's Google Photos Albums tab using the \u003ccode\u003eGET https://photoslibrary.googleapis.com/v1/albums\u003c/code\u003e request.\u003c/p\u003e\n"],["\u003cp\u003eAllows pagination with \u003ccode\u003epageSize\u003c/code\u003e and \u003ccode\u003epageToken\u003c/code\u003e query parameters to control the number of albums returned and retrieve subsequent pages.\u003c/p\u003e\n"],["\u003cp\u003eThe response provides a list of \u003ccode\u003ealbums\u003c/code\u003e and a \u003ccode\u003enextPageToken\u003c/code\u003e for further navigation if available.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with one of the specified OAuth scopes, such as \u003ccode\u003ehttps://www.googleapis.com/auth/photoslibrary\u003c/code\u003e, for access.\u003c/p\u003e\n"],["\u003cp\u003eCan exclude non-app created data using the \u003ccode\u003eexcludeNonAppCreatedData\u003c/code\u003e parameter or the \u003ccode\u003ephotoslibrary.readonly.appcreateddata\u003c/code\u003e scope.\u003c/p\u003e\n"]]],["To retrieve a user's albums from Google Photos, send a `GET` request to `https://photoslibrary.googleapis.com/v1/albums`. The request body must be empty. Optional query parameters include `pageSize` (default 20, max 50), `pageToken` for pagination, and `excludeNonAppCreatedData`. The response contains an array of album objects and `nextPageToken` for subsequent requests. Authorization requires one of three specified OAuth scopes.\n"],null,["# Method: albums.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.ListAlbumsResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nLists all albums shown to a user in the Albums tab of the Google Photos app.\n\n### HTTP request\n\n`GET https://photoslibrary.googleapis.com/v1/albums`\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 albums to return in the response. Fewer albums might be returned than the specified number. The default `pageSize` is 20, the maximum is 50. |\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 `listAlbums` request. |\n| `excludeNonAppCreatedData` | `boolean` If set, the results exclude media items that were not created by this app. Defaults to false (all albums are returned). This field is ignored if the photoslibrary.readonly.appcreateddata scope is used. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nList of albums requested.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------|\n| ``` { \"albums\": [ { object (/photos/library/legacy/reference/rest/v1/albums#Album) } ], \"nextPageToken\": string } ``` |\n\n| Fields ||\n|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `albums[]` | `object (`[Album](/photos/library/legacy/reference/rest/v1/albums#Album)`)` Output only. List of albums shown in the Albums tab of the user's Google Photos app. |\n| `nextPageToken` | `string` Output only. Token to use to get the next set of albums. Populated if there are more albums to retrieve for this 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`"]]