您目前查看的是 Google Photos Library API 的舊版說明文件。
Method: albums.share
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將相簿標示為已分享且可供其他使用者存取。這項動作只能對開發人員透過 API 建立的相簿執行。
HTTP 要求
POST https://photoslibrary.googleapis.com/v1/albums/{albumId}:share
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
albumId |
string
必要欄位。要共享的相簿 ID。這個 albumId 必須屬於開發人員建立的相簿。
|
要求主體
要求主體的資料會採用以下結構:
欄位 |
sharedAlbumOptions |
object (SharedAlbumOptions )
將相簿轉換為共享相簿時要設定的選項。
|
回應主體
回應成功共享相簿。
如果成功,回應主體會含有以下結構的資料:
JSON 表示法 |
{
"shareInfo": {
object (ShareInfo )
}
} |
欄位 |
shareInfo |
object (ShareInfo )
僅供輸出。共享相簿的相關資訊。
|
授權範圍
需要下列 OAuth 範圍:
https://www.googleapis.com/auth/photoslibrary.sharing
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eMarks an album as shared, making it accessible to other users, but only for albums created via the API.\u003c/p\u003e\n"],["\u003cp\u003eRequires an HTTP POST request to a specific URL with the album ID as a path parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe request body includes shared album options, and the response provides shared album information.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization is necessary using the \u003ccode\u003ehttps://www.googleapis.com/auth/photoslibrary.sharing\u003c/code\u003e scope.\u003c/p\u003e\n"]]],[],null,["# Method: albums.share\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ShareAlbumResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nMarks an album as shared and accessible to other users. This action can only be performed on albums which were created by the developer via the API.\n\n### HTTP request\n\n`POST https://photoslibrary.googleapis.com/v1/albums/{albumId}:share`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-----------|---------------------------------------------------------------------------------------------------------------------------|\n| `albumId` | `string` Required. Identifier of the album to be shared. This `albumId` must belong to an album created by the developer. |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"sharedAlbumOptions\": { object (/photos/library/legacy/reference/rest/v1/albums#Album.SharedAlbumOptions) } } ``` |\n\n| Fields ||\n|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `sharedAlbumOptions` | `object (`[SharedAlbumOptions](/photos/library/legacy/reference/rest/v1/albums#Album.SharedAlbumOptions)`)` Options to be set when converting the album to a shared album. |\n\n### Response body\n\nResponse to successfully sharing an album.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------|\n| ``` { \"shareInfo\": { object (/photos/library/legacy/reference/rest/v1/albums#Album.ShareInfo) } } ``` |\n\n| Fields ||\n|-------------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| `shareInfo` | `object (`[ShareInfo](/photos/library/legacy/reference/rest/v1/albums#Album.ShareInfo)`)` Output only. Information about the shared album. |\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/photoslibrary.sharing`"]]