您正在查看 Google Photos Library API 的旧版文档。
Method: albums.share
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
将影集标记为共享影集,以供其他用户访问。您只能在由开发者通过 API 创建的影集上执行该操作。
HTTP 请求
POST https://photoslibrary.googleapis.com/v1/albums/{albumId}:share
网址采用 gRPC 转码语法。
路径参数
参数 |
albumId |
string
必需。要分享的影集的标识符。此 albumId 必须属于由开发者创建的影集。
|
请求正文
请求正文中包含结构如下的数据:
字段 |
sharedAlbumOptions |
object (SharedAlbumOptions )
将影集转换为共享影集时要设置的选项。
|
响应正文
影集分享成功的响应。
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"shareInfo": {
object (ShareInfo )
}
} |
字段 |
shareInfo |
object (ShareInfo )
仅限输出。共享影集的相关信息。
|
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/photoslibrary.sharing
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):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`"]]