开发者社区> 问答> 正文

云相册的API开发接口GetThumbnails怎么使用



描述


批量获取照片的缩略图下载地址,支持一次获取100张图片的缩略图。地址的有效期为1小时。
注:SDK1.1.3版本后支持该接口。

请求参数

参数名类型是否必须说明
ActionStringGetThumbnails
PhotoId.1Long需要获取缩略图地址的照片的ID。如果有多张照片,请按照规则增加一个参数,比如2张照片,另外一个参数为PhotoId.2
StoreNameStringPhotoStore的名称
ZoomTypeStringOSS的新版缩略图格式,比如image/resize,h_100将图片缩略成高度为100,宽度按比例处理。更多缩放格式请参考OSS的新版缩放格式
LibraryIdString照片库标识。采用AK认证时必选,采用STS认证时可选。了解不同认证方式的区别。


请求示例https://cloudphoto.cn-shanghai.aliyuncs.com/?Action=GetThumbnails
&PhotoId.1=822879673959591936&PhotoId.2=822879673959591937
&StoreName=cloudphoto-demo
&ZoomType=image/resize,h_100
&LibraryId=alice-001
&<公共请求参数>





返回参数

参数名类型说明
RequestIdString唯一标识本次请求的ID
CodeString响应状态码,Success表示成功的响应
MessageString响应状态详细描述
ActionStringGetThumbnails
Results数组详见结果信息


Results

参数名类型说明
CodeString状态码,Success表示成功
IdString对应对象的唯一标识
MessageString详细信息
ThumbnailUrlString图片缩略图的下载地址


返回示例


JSON格式 {
    "Action":"GetThumbnails",
    "Message":"success",
    "RequestId":"95F81B72-12C7-4AC4-89B7-2FB9F2696DD7",
    "Code":"Success",
    "Results": [
        {
            "PhotoId": "822879673959591936",
            "Code": "Success",
            "Message": "success",
            "ThumbnailUrl": "http://cloudphoto-demo.img-cn-shanghai.aliyuncs.com/stores/cloudphoto-demo/data/ZUBaS964T3OYtqaal9MaZwAAAApwZDIE%40300w_300h_2o?Expires=1500091060&OSSAccessKeyId=STS.FoGkyomEnL5oiHy1aJ3jpusyU&Signature=VNlRDk4McBHevu5QeZ7US2sKHD0%3D&security-token=CAISkAJ1q6Ft5B2yfSjIp6zyIMPbgJpP%2B%2FeEa27I1WEfP%2BVcmrbStzz2IH9PdXRuCe4esv00mmlW7PYelr94T5hYSVTEatd3q5pW9Q66bpDfuse4tTjOFj0ZWjr9MQXy%2BeOPScebJYqvV5XAQlTAkTAJstmeXD6%2BXlujHISUgJp8FLo%2BVRW5ajw0b7U%2FZHEVyqkgOGDWKOymPzPzn2PUFzAIgAdnjn5l4qnNqa%2F1qDim1QekkL5F%2F9%2Brf8b9M5YwYa0SCYnlgLZEEYPayzNV5hRw86N7sbdJ4z%2BvvKvGXAIAvkvWbbKIq4YxdVEjNvQgaKdArenhk%2FZ8vfHfj4Tw1xFBMO9cTiDDXoekzdsTol0B%2F26DHxqAARn%2Fi1CNr7skp0WWXB9gdt1zE4fgxQGK7sRoSBQFs5vRffWu6WKUGdipTB24%2F3x%2B05FjIUJqBajZBUY6r0HvcChWlzoS%2FelZG0ANkCrnkjRAK7aKc6eW44dOmV8WaLiuW%2F%2FOTSo%2BCyAdfyeq%2B5jRV8hipnBpuy8%2FR5B9fAYl%2FPwr"
        },
        {
            "PhotoId": "822879673959591937",
            "Code": "ResourceNotFound.PhotoId",
            "Message": "resource not found",
            "ThumbnailUrl": ""
        }
    ]
}


XML格式 <?xml version="1.0" encoding="UTF-8"?>
<GetThumbnailResponse>
  <Action>GetThumbnail</Action>
  <Message>success</Message>
  <RequestId>9D552BFC-2582-4899-84A2-E74C1BF4AF75</RequestId>
  <Results>
      <Result>
        <PhotoId>822879673959591936</PhotoId>
        <Code>Success</Code>
        <Message>success</Message>
        <ThumbnailUrl><![CDATA[http://cloudphoto-demo.img-cn-shanghai.aliyuncs.com/stores/cloudphoto-demo/data/ZUBaS964T3OYtqaal9MaZwAAAApwZDIE%40300w_300h_2o?Expires=1500091061&OSSAccessKeyId=STS.GiB8eHBKg6vW2weopJQQHwjNj&Signature=o7eUTDT3jMEBohv9c8EMvSQrThw%3D&security-token=CAISkAJ1q6Ft5B2yfSjIpqr3c9%2F8r5RGgbS8MFHUi3AfXd5kmK%2FliDz2IH9PdXRuCe4esv00mmlW7PYelr94T5hYSVTEatd3q5pW9Q66bpDfuse4tXHKFj0ZWjr9MQXy%2BeOPScebJYqvV5XAQlTAkTAJstmeXD6%2BXlujHISUgJp8FLo%2BVRW5ajw0b7U%2FZHEVyqkgOGDWKOymPzPzn2PUFzAIgAdnjn5l4qnNqa%2F1qDim1QekkL5F%2F9%2Brf8b9M5YwYa0SCYnlgLZEEYPayzNV5hRw86N7sbdJ4z%2BvvKvGXAIAvkvWbbKIq4YxdVEjNvQgaKdArenhk%2FZ8vfHfj4Tw1xFBMO9cTiDDXoekzdsTol0B%2F26DHxqAASMZ%2BwKcaBwU0gS%2B%2FYPaecXKYsoSFTyMhTM0v43YXXOZf18vRokrybrxe5HsDhamGv4KVKfvQ%2FEDeGCSX%2BP%2BSUiWMrOThZgPxZtfNcBMsOffg8FEfEZ9sJtZN%2FE5ssN3HUjVLqRMCcauKiGNpmfiMGQQ1hn3xq%2FhNUfrz0o15RHX]]>
        </ThumbnailUrl>
    </Result>
    <Result>
        <PhotoId>822879673959591937</PhotoId>
        <Code>ResourceNotFound.PhotoId</Code>
        <Message>resource not found</Message>
        <ThumbnailUrl></ThumbnailUrl>
    </Result>
  </Results>
  <Code>Success</Code>
</GetThumbnailResponse>

展开
收起
云栖大讲堂 2017-10-27 10:18:13 1987 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
Spring Boot2.0实战Redis分布式缓存 立即下载
CUDA MATH API 立即下载
API PLAYBOOK 立即下载