更新时间:2025-08-27 11:19:50
该接口用于在云存储平台对压缩包进行解压缩操作。解压缩完成后,系统会在云存储中默认生成一个list文件,内容为解压后的文件信息。用户需具备wos:ProcessMedia权限、目标文件的putObject权限;若配置了解压后删除源文件,还需具备deleteObject权限。
Post /key?decompression HTTP/1.1
Host:Bucket.Endpoint
Date:Date
Authorization:Authorization
<?xml version="1.0" encoding="utf-8"?>
<Decompression xmlns="http://wcs.chinanetcenter.com/document">
<Config>
<Param>
<format>string</format>
<bucket>string</bucket>
...
</Param>
<Output>
<OutputBucket>string</OutputBucket>
<OutputKey>string</OutputKey>
</Output>
</Config>
<NotifyURL>string</NotifyURL>
<Force>int</Force>
</Decompression>
无
仅需使用公共请求头。
请求主体为如下XML信息:
| 元素名称 | 元素描述 | 是否必填 |
|---|---|---|
| Decompression | 定义解压缩处理配置列表。 类型:XML 子节点:Config、NotifyURL、Force 父节点:空 |
是 |
| Config | 定义解压缩处理操作。 类型:XML 子节点:Param、Output 父节点:Decompression |
是 |
| Param | 定义解压缩处理的详细配置。 类型:XML 子节点:format, dir等 父节点:Config |
是 |
| Output | 定义输出文件的信息。 类型:XML 子节点:OutputBucket、OutputKey 父节点:Config |
是 |
| OutputBucket | 输出文件的空间名称。 类型:字符串 父节点:Output |
否 |
| OutputKey | 输出文件的文件名。需进行UrlEncode编码。 类型:字符串 父节点:Output |
否 |
| NotifyURL | 处理结果通知接收URL。需进行UrlEncode编码。 类型:字符串 父节点:Decompression |
否 |
| Force | 是否强制执行数据处理。支持设置以下数值,默认缺省为0。 0:若指定的数据处理结果已存在,返回文件已存在,则不处理,避免重复处理浪费资源。 1:强制执行数据处理,并覆盖已有文件。 类型:整型 父节点:Decompression |
否 |
请求成功时,返回以下内容:
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
Date: date
Server: WS-web-server
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DecompressionResult xmlns="http://wcs.chinanetcenter.com/document">
<Succeed>
<PersistentId>string</PersistentId>
</Succeed>
</DecompressionResult>
仅使用公共响应头。
| 元素名称 | 元素描述 |
|---|---|
| PersistentId | 解压缩处理的任务ID |
示例
Post /test.zip?decompression HTTP/1.1
Host:Bucket.Endpoint
Date:Date
Authorization:Authorization
<?xml version="1.0" encoding="utf-8"?>
<Decompression xmlns="http://wcs.chinanetcenter.com/document">
<Config>
<Param>
<format>zip</format>
<crush>0</crush>
</Param>
<Output>
<OutputBucket>excite</OutputBucket>
<OutputKey>test.list</OutputKey>
</Output>
</Config>
</Decompression>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
Date: date
Server: WS-web-server
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DecompressionResult xmlns="http://wcs.chinanetcenter.com/document">
<Succeed>
<PersistentId>20500a49659******e088b1f736aa2a4</PersistentId>
</Succeed>
</DecompressionResult>
该接口用于在云存储中查询解压缩持久化处理的状态。用户需具备wos:GetProcessMediaStatus权限。
Get /?decompression&persistentId=<persistentId>
Host:Bucket.Endpoint
Date:Date
Authorization:Authorization
| 参数名称 | 是否必填 | 参数描述 |
|---|---|---|
| persistentId | 是 | 解压缩处理接口返回的persistentId。 |
仅需使用公共请求头。
无
HTTP/1.1 StatusCode
Date: Date
Content-Type: type
Content-Length: length
Server: WS-web-server
<?xml version="1.0" encoding="utf-8"?>
<QueryDecompressionResult xmlns="https://wcs.chinanetcenter.com/document">
<Id>string</Id>
<CreationTime>string</CreationTime>
<Input>
<Bucket>string</Bucket>
<Key>string</Key>
<Size>int</Size>
</Input>
<Item>
<Cmd>string</Cmd>
<Code>int</Code>
<Desc>string</Desc>
<CostTime>int</CostTime>
<Error>string</Error>
<Output>
<OutputBucket>string</OutputBucket>
<OutputKey>string</OutputKey>
<Size>int</Size>
</Output>
</Item>
</QueryDecompressionResult>
仅使用公共响应头。
Get /?decompression&persistentId=20500a496******b1f736aa2a4
Host:Bucket.Endpoint
Date:Date
Authorization:Authorization
响应示例
HTTP/1.1 200 OK
Content-Type:application/xml
Content-Length:length
Date:date
Server: WS-web-server
<?xml version="1.0" encoding="utf-8"?>
<QueryDecompressionResult xmlns="https://wcs.chinanetcenter.com/document">
<Id>20500a496******b1f736aa2a4</Id>
<CreationTime>2019-05-16T03:16:05Z</CreationTime>
<Input>
<Bucket>sweet</Bucket>
<Key>happy%2Ftest.zip</Key>
<Size>1000</Size>
</Input>
<Item>
<Cmd>decompression/zip</Cmd>
<Code>3</Code>
<CostTime>0</CostTime>
<Desc>finish</Desc>
<Error>null</Error>
<Output>
<OutputBucket>excite</OutputBucket>
<OutputKey>test.list</OutputKey>
<Size>2000</Size>
</Output>
</Item>
</QueryDecompressionResult>
通知数据格式如下:
<?xml version="1.0" encoding="utf-8"?>
<NotifyBody xmlns="https://wcs.chinanetcenter.com/document">
<Id>string</Id>
<CreatTime>string</CreatTime>
<Input>
<Bucket>string</Bucket>
<Key>string</Key>
<Size>int</Size>
</Input>
<Item>
<Cmd>string</Cmd>
<Code>int</Code>
<Desc>string</Desc>
<CostTime>int</CostTime>
<Error>string</Error>
<Output>
<OutputBucket>string</OutputBucket>
<OutputKey>string</OutputKey>
<Size>int</Size>
<Hash>string</Hash>
</Output>
</Item>
</NotifyBody>
| 参数名称 | 描述 |
|---|---|
| NotifyBody | 返回持久化处理结果。类型:XML |
| Id | 持久化处理接口返回的 persistentId。类型:字符串。父节点:NotifyBody |
| CreationTime | 任务创建时间,格式为 yyyymmddhhmmss。类型:字符串。父节点:NotifyBody |
| Input | 源文件的信息。类型:XML。父节点:NotifyBody。子节点:Bucket, Key, Size |
| Bucket | 源文件的空间名。类型:字符串。父节点:Input |
| Key | 源文件的文件名,需进行 UrlEncode 编码。类型:字符串。父节点:Input |
| Size(Input) | 源文件的大小。类型:整型。父节点:Input |
| Item | 解压缩操作的状态信息。类型:XML。父节点:NotifyBody。子节点:Cmd、Code等 |
| Cmd | 操作命令(ops)。类型:字符串。父节点:Item |
| Code | 处理结果状态码,2表示失败,3表示成功。类型:整型。父节点:Item |
| Desc | 状态码对应的详细描述。类型:字符串。父节点:Item |
| CostTime | 持久化处理耗时,非特殊场景默认是0。类型:整型。父节点:Item |
| Error | 处理失败时的具体原因。类型:字符串。父节点:Item |
| Output | 处理后的文件信息。类型:XML。父节点:Item |
| OutputBucket | 处理后文件的空间名。类型:字符串。父节点:Output |
| OutputKey | 处理后文件名,需进行 UrlEncode 编码。类型:字符串。父节点:Output |
| Size(Output) | 处理后文件的大小。类型:整型。父节点:Output |
| Hash | 处理结果的 hash 值。类型:字符串。父节点:Output |
| 参数 | 是否必填 | 描述 |
|---|---|---|
| bucket | 否 | 解压文件存储到指定空间。 |
| crush | 否 | 解压成功后的操作: 2-解压成功后删除压缩文件,不创建list文件 1-解压成功后删除压缩文件,保留list文件 0-解压成功后保留压缩文件,保留list文件 |
| format | 是 | 解压的文件格式,支持 zip、tar、gzip、7z、rar |
| p | 否 | 指定解压文件时的密码。需进行RSA加密: 1. RSA密钥对由客户提供,并将公钥告知对象存储。 |
| prefix | 否 | 解压文件到指定的具体路径,需进行UrlEncode编码。默认以当前压缩包目录进行解压缩。 |
注意:如需删除源文件,必须具备
deleteObject权限。