Bạn đang xem tài liệu cũ về API Thư viện Google Photos.
Tổng quan về API thư viện
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.
Khi sử dụng API Thư viện Google Photos, ứng dụng của bạn có thể đọc, ghi và chia sẻ ảnh cũng như video trong Google Photos.
API thư viện là một API RESTful có tải trọng JSON. Cấu trúc của API dựa trên các khái niệm sản phẩm của Google Photos:
- Thư viện: nội dung nghe nhìn được lưu trữ trong tài khoản Google Photos của người dùng.
- Album: bộ sưu tập nội dung nghe nhìn có thể chia sẻ với người dùng khác.
- Mục nội dung đa phương tiện: ảnh, video và siêu dữ liệu của các mục đó.
- Chia sẻ: tính năng cho phép người dùng chia sẻ nội dung nghe nhìn của họ với người dùng khác.
Ủy quyền
Giống như các API REST khác của Google, API thư viện sử dụng OAuth 2.0 để xử lý hoạt động uỷ quyền.
Ứng dụng của bạn có thể yêu cầu quyền truy cập vào thư viện Google Photos của người dùng thông qua nhiều phạm vi uỷ quyền do API cung cấp.
Lưu ý rằng API Thư viện không hỗ trợ tài khoản dịch vụ. Để sử dụng API này, người dùng phải đăng nhập vào một Tài khoản Google hợp lệ.
Sử dụng API Thư viện
Trước khi bạn bắt đầu quá trình phát triển ứng dụng, hãy lưu ý những điều sau:
Khám phá API
Để dùng thử API Thư viện mà không cần viết mã, hãy sử dụng Trình khám phá API có trong tài liệu tham khảo.
Dưới đây là một số phương thức để thử sử dụng API Explorer:
Hãy xem mã mẫu cho thấy một số tính năng chính của API Thư viện.
Chương trình đối tác
Bạn có thể tích hợp với API Thư viện Google Photos mà không cần tham gia chương trình đối tác.
Tuy nhiên, nếu ứng dụng của bạn có khả năng vượt quá hạn mức phát hành chung, hãy bày tỏ sự quan tâm đến chương trình đối tác Google Photos.
Tìm hiểu thêm
Một số nơi bạn có thể đi từ đây:
- Bắt đầu: định cấu hình dự án của bạn và dùng thử mẫu.
- Hướng dẫn: hướng dẫn và khái niệm về cách sử dụng API thư viện.
- Tài liệu tham khảo: tài liệu tham khảo API
- Support (Hỗ trợ): các tuỳ chọn hỗ trợ để yêu cầu trợ giúp hoặc gửi ý kiến phản hồi.
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-08-29 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-29 UTC."],[[["\u003cp\u003eThe Google Photos Library API allows your app to read, write, and share photos and videos stored in Google Photos.\u003c/p\u003e\n"],["\u003cp\u003eIt uses a RESTful API with JSON payload and OAuth 2.0 for authorization, requiring users to be signed in to a Google Account.\u003c/p\u003e\n"],["\u003cp\u003eBefore developing your app, review the acceptable use policy, UX guidelines, and API limits and quotas.\u003c/p\u003e\n"],["\u003cp\u003eExplore the API through the API Explorer or by checking out the provided code samples.\u003c/p\u003e\n"],["\u003cp\u003eConsider joining the Google Photos partner program if your app is likely to exceed the general availability quota limit.\u003c/p\u003e\n"]]],["The Google Photos Library API enables apps to interact with Google Photos content, reading, writing, and sharing photos and videos. It's a RESTful API using JSON payloads, organized around libraries, albums, media items, and sharing. Access requires OAuth 2.0 authorization via specific scopes, and service accounts are not supported. Developers should adhere to usage policies, UX guidelines, and quotas. The API can be explored through the API Explorer, and code samples are available. Those who need more quota should apply to the Google Photos partner program.\n"],null,["# Library API overview\n\nUsing the Google Photos Library API your app can read, write, and share photos and videos in\nGoogle Photos.\n\nThe Library API is a [RESTful\nAPI](/photos/library/legacy/guides/about-restful-apis) with JSON payload. The structure\nof the API is based on the product concepts of Google Photos:\n\n- [Library](/photos/library/legacy/guides/list): media stored in the user's Google Photos account.\n- [Albums](/photos/library/legacy/guides/manage-albums): media collections which can be shared with other users.\n- [Media items](/photos/library/legacy/guides/access-media-items): photos, videos, and their metadata.\n- [Sharing](/photos/library/legacy/guides/share-media): feature that enables users to share their media with other users.\n\nAuthorization\n-------------\n\nLike other Google REST APIs, the Library API uses [OAuth\n2.0](/identity/protocols/OAuth2) to handle authorization.\nYour app can request access to the user's Google Photos library via the\nvarious [authorization\nscopes](/photos/library/legacy/guides/authorization) provided by the\nAPI.\n\nNote that the Library API does not support service accounts; to use this\nAPI, users must be signed in to a valid Google Account.\n\nUsing the Library API\n---------------------\n\nBefore you get started on your app development, keep the following in mind:\n\n- [Acceptable use policy](/photos/library/legacy/guides/acceptable-use)\n- [UX guidelines](/photos/library/legacy/guides/ux-guidelines) for designing your app\n- The Library API [limits and\n quotas](/photos/library/legacy/guides/api-limits-quotas)\n\nExplore the API\n---------------\n\nTo try out the Library API without writing any code, use the API Explorer\navailable in the reference documentation.\n\nHere are some methods to try using the API Explorer:\n\n- [List](/photos/library/legacy/reference/rest/v1/albums/list) your albums.\n- Apply filters to a [media item\n search](/photos/library/legacy/reference/rest/v1/mediaItems/search).\n\nCheck out our [code sample](/photos/library/samples) that shows some of the key\nfeatures of the Library API.\n\nPartner program\n---------------\n\nYou can integrate with the Google Photos Library API without joining the partner program.\nHowever, if your app is likely to exceed the general availability [quota\nlimit](/photos/library/legacy/guides/api-limits-quotas), express interest in the [Google Photos\npartner program](/photos/partner-program).\n\nLearn more\n----------\n\nSome places to go from here:\n\n- [Get started](/photos/library/legacy/guides/get-started): configure your project and try out the sample.\n- [Guides](/photos/library/legacy/guides/list): the how-to guides and concepts around using the Library API.\n- [Reference](/photos/library/reference): the API reference documentation\n- [Support](/photos/library/support/how-to-get-help): the support options for requesting help or giving feedback."]]