上载令牌
可确保他人不能使用相同的共享密钥来上载资源。它可确保上载合法且来自信任的来源。
上载令牌是字母数字字符串,只能在特定时间段内使用。请使用以下 URL 代替您的共享密钥来检索上载令牌。
默认情况下,上载令牌在您检索到它之后 5 分钟(300 秒)便到期。要请求更多时间,请在 URL 中添加
expires
和要需要的时间量(以秒为单位)。例如,以下示例图像 URL 检索有效期为 1800 秒的上载令牌:
https://s7ugc1.scene7.com/ugc/image?op=get_uploadtoken&shared_secret=fece4b21-87ee-47fc-9b99-2e29b78b602&expires=1800
图像的成功响应如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scene7>
<user_generated_content>
<response>
<serviceName>User Generated Content - Images</serviceName>
<version>1.0.0</version>
<operationName>get_uploadtoken</operationName>
<serviceStatus>SUCCESS</serviceStatus>
<title>Upload Token for fece4b21-87ee-47fc-9b99-2e29b78b602</title>
<message>
<uploadtoken>aa2a378a-cd25-4c80-994d-312094e0ef20_1800</uploadtoken>
<expiration_in_seconds>1800</expiration_in_seconds>
</message>
</response>
</user_generated_content>
</scene7>
将上载令牌保存到本地,以备以后请求时使用。
您可以在查询 URL 字符串中使用以下字段来检索上载令牌:
URL 参数
|
必需或可选
|
值
|
op
|
必需
|
get_uploadtoken
|
shared_secret
|
必需
|
正在进行上载的公司的共享密钥。
|
expires
|
可选
|
上载令牌有效的秒数。如果不指定,则默认为 300 秒。
|
示例图像 URL:
https://s7ugc1.scene7.com/ugc/image?op=get_uploadtoken&shared_secret=fece4b21-87ee-47fc-9b99-2e29b78b602&expires=600
示例矢量 URL:
http://s7ugc1.scene7.com/ugc/vector?op=get_uploadtoken&shared_secret=2d19f60e-890a-4e79-a1a5-9ac2875429b9&expires=5000
允许的 HTTP 方法:
GET 和 POST
您现在可以上载图像资源。
请参阅
上载图像资源
。
|
|
|