2025 年 4 月 1 日,Library API 中的部分範圍已遭到移除。
詳情請參閱這篇文章。
Photos Library API
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
管理應用程式在 Google 相簿中建立的相片、影片和相簿
服務:photoslibrary.googleapis.com
服務端點
服務端點是指定 API 服務網路位址的基準網址。一項服務可能有多個服務端點。這項服務有以下服務端點,且下方的 URI 皆以此服務端點為基準:
https://photoslibrary.googleapis.com
方法 |
addEnrichment |
POST /v1/albums/{albumId}:addEnrichment
在應用程式建立的相簿中,在指定位置新增強化內容。 |
batchAddMediaItems |
POST /v1/albums/{albumId}:batchAddMediaItems
將使用者 Google 相簿相片庫中由應用程式建立的一或多個媒體項目新增至應用程式建立的相簿。 |
batchRemoveMediaItems |
POST /v1/albums/{albumId}:batchRemoveMediaItems
從指定的應用程式建立的相簿中移除一或多個應用程式建立的媒體項目。 |
create |
POST /v1/albums
在使用者的 Google 相簿程式庫中建立相簿。 |
get |
GET /v1/albums/{albumId}
根據指定的 albumId 傳回應用程式建立的相簿。 |
list |
GET /v1/albums
列出應用程式建立的所有相簿。 |
patch |
PATCH /v1/albums/{album.id}
使用指定的 id 更新應用程式建立的相簿。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eThe Google Photos Library API allows you to manage photos, videos, and albums programmatically through REST resources.\u003c/p\u003e\n"],["\u003cp\u003eThe API provides methods to interact with albums, including creating, adding enrichments, managing media items, and sharing (although sharing functionality will be deprecated on March 31, 2025).\u003c/p\u003e\n"],["\u003cp\u003eYou can also access and manipulate individual media items, such as retrieving details, updating properties, and performing searches.\u003c/p\u003e\n"],["\u003cp\u003eShared albums can be accessed, joined, and left, but these features are also scheduled for deprecation on March 31, 2025.\u003c/p\u003e\n"],["\u003cp\u003eAll interactions with the API are performed through the service endpoint \u003ccode\u003ehttps://photoslibrary.googleapis.com\u003c/code\u003e.\u003c/p\u003e\n"]]],["This API allows management of photos, videos, and albums in Google Photos via `photoslibrary.googleapis.com`. Key actions include creating, getting, listing, patching, adding, and removing media items within albums. It supports batch operations for media items and enrichment. Albums can be shared or unshared. Shared albums can be joined, left, retrieved, and listed. Several methods will no longer function after March 31, 2025 and other have some scope changes.\n"],null,["# Photos Library API\n\nManage photos, videos, and albums created by your app in Google Photos\n\n- [REST Resource: v1.albums](#v1.albums)\n- [REST Resource: v1.mediaItems](#v1.mediaItems)\n\nService: photoslibrary.googleapis.com\n-------------------------------------\n\n### Service endpoint\n\nA [service endpoint](https://cloud.google.com/apis/design/glossary#api_service_endpoint) is a base URL that specifies the network address of an API service. One service might have multiple service endpoints. This service has the following service endpoint and all URIs below are relative to this service endpoint:\n\n- `https://photoslibrary.googleapis.com`\n\nREST Resource: [v1.albums](/photos/library/reference/rest/v1/albums)\n--------------------------------------------------------------------\n\n| Methods ||\n|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [addEnrichment](/photos/library/reference/rest/v1/albums/addEnrichment) | `POST /v1/albums/{albumId}:addEnrichment` Adds an enrichment at a specified position in an app created created album. |\n| [batchAddMediaItems](/photos/library/reference/rest/v1/albums/batchAddMediaItems) | `POST /v1/albums/{albumId}:batchAddMediaItems` Adds one or more app created media items in a user's Google Photos library to an app created album. |\n| [batchRemoveMediaItems](/photos/library/reference/rest/v1/albums/batchRemoveMediaItems) | `POST /v1/albums/{albumId}:batchRemoveMediaItems` Removes one or more app created media items from a specified app created album. |\n| [create](/photos/library/reference/rest/v1/albums/create) | `POST /v1/albums` Creates an album in a user's Google Photos library. |\n| [get](/photos/library/reference/rest/v1/albums/get) | `GET /v1/albums/{albumId}` Returns the app created album based on the specified `albumId`. |\n| [list](/photos/library/reference/rest/v1/albums/list) | `GET /v1/albums` Lists all albums created by your app. |\n| [patch](/photos/library/reference/rest/v1/albums/patch) | `PATCH /v1/albums/{album.id}` Update the app created album with the specified `id`. |\n\nREST Resource: [v1.mediaItems](/photos/library/reference/rest/v1/mediaItems)\n----------------------------------------------------------------------------\n\n| Methods ||\n|-------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|\n| [batchCreate](/photos/library/reference/rest/v1/mediaItems/batchCreate) | `POST /v1/mediaItems:batchCreate` Creates one or more media items in a user's Google Photos library. |\n| [batchGet](/photos/library/reference/rest/v1/mediaItems/batchGet) | `GET /v1/mediaItems:batchGet` Returns the list of app created media items for the specified media item identifiers. |\n| [get](/photos/library/reference/rest/v1/mediaItems/get) | `GET /v1/mediaItems/{mediaItemId}` Returns the app created media item for the specified media item identifier. |\n| [list](/photos/library/reference/rest/v1/mediaItems/list) | `GET /v1/mediaItems` List all media items created by your app from a user's Google Photos library. |\n| [patch](/photos/library/reference/rest/v1/mediaItems/patch) | `PATCH /v1/mediaItems/{mediaItem.id}` Update the app created media item with the specified `id`. |\n| [search](/photos/library/reference/rest/v1/mediaItems/search) | `POST /v1/mediaItems:search` Searches for app created media items in a user's Google Photos library. |"]]