Decompression

Last update:2025-08-27 11:19:50

This API is used to perform decompression operations on compressed files within the cloud storage platform. After decompression is complete, the system automatically generates a list file in cloud storage, which contains information about the decompressed files. To use this interface, users must have the wos:ProcessMedia permission and putObject permission for the target file. If you configure the task to delete the source file after decompression, you will also need the deleteObject permission.

Create a Decompression Task

Request Syntax

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>

Request Parameters

None.

Request Headers

Only Common Request Headers are required.

Request Body

The request body should contain XML data as follows:

Element Name Description Required
Decompression Defines the decompression configuration list.
Type: XML
Children: Config, NotifyURL, Force
Parent: None
Yes
Config Defines the decompression operation.
Type: XML
Children: Param, Output
Parent: Decompression
Yes
Param Specifies detailed configuration for decompression.
Type: XML
Children: format, dir, etc.
Parent: Config
Yes
Output Defines output file information.
Type: XML
Children: OutputBucket, OutputKey
Parent: Config
Yes
OutputBucket The name of the bucket where the output file will be stored.
Type: string
Parent: Output
No
OutputKey The output file name. Should be UrlEncoded.
Type: string
Parent: Output
No
NotifyURL Notification URL for processing results. Should be UrlEncoded.
Type: string
Parent: Decompression
No
Force Whether to force data processing. The default is 0.
Possible values:
0: If the processed result already exists, the system will not reprocess but will return “file already exists” to avoid unnecessary resource consumption.
1: Force processing and overwrite existing files.
Type: integer
Parent: Decompression
No

Response Syntax

On success, the response will be:

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>

Response Headers

Only Common Response Headers are used.

Response Elements

Element Name Description
PersistentId The task ID for decompression

Example

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>

Query Decompression Task Status

This API allows you to query the status of a decompression persistent task in cloud storage. The wos:GetProcessMediaStatus permission is required.

Request Syntax

GET /?decompression&persistentId=<persistentId>
Host: Bucket.Endpoint
Date: Date
Authorization: Authorization

Request Parameters

Parameter Name Required Description
persistentId Yes The persistentId returned by the decompression API.

Request Headers

Only Common Request Headers are required.

Request Body

None.

Response Syntax

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>

Response Headers

Only Common Response Headers are used.

Example

Request Example:
GET /?decompression&persistentId=20500a496******b1f736aa2a4
Host: Bucket.Endpoint
Date: Date
Authorization: Authorization

Response Example
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>

Decompression Notification Data Description

Notification data is formatted as follows:

<?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>

Parameter Description

Parameter Name Description
NotifyBody Returns the results of the persistent processing. Type: XML
Id The persistentId returned by the interface. Type: string. Parent: NotifyBody
CreationTime Task creation time, formatted as yyyymmddhhmmss. Type: string. Parent: NotifyBody
Input Information about the source file. Type: XML. Parent: NotifyBody. Children: Bucket, Key, Size
Bucket The bucket name of the source file. Type: string. Parent: Input
Key Source file name, UrlEncoded. Type: string. Parent: Input
Size (Input) Size of the source file. Type: integer. Parent: Input
Item Status information about the decompression operation. Type: XML. Parent: NotifyBody
Cmd Operation command (ops). Type: string. Parent: Item
Code Result status code; 2 for failure, 3 for success. Type: integer. Parent: Item
Desc Detailed description of the status code. Type: string. Parent: Item
CostTime Time consumed by the persistent process. Usually 0 in non-special cases. Type: integer. Parent: Item
Error Specific reason for failure. Type: string. Parent: Item
Output Information about the processed file. Type: XML. Parent: Item
OutputBucket Bucket name for processed files. Type: string. Parent: Output
OutputKey Processed file name, UrlEncoded. Type: string. Parent: Output
Size (Output) Size of the processed file. Type: integer. Parent: Output
Hash Hash value of the processing result. Type: string. Parent: Output

Decompression Parameter Details

Parameter Required Description
bucket No Save the decompressed files to the specified bucket.
crush No Post-decompression actions:
2 - Delete the compressed file without creating a list file
1 - Delete the compressed file, keep the list file
0 - Keep both compressed file and list file
format Yes Compression file format, supports zip, tar, gzip, 7z, rar
p No Password for decompression. Must be RSA-encrypted:
1. Customers provide their own RSA key pair and share the public key with object storage.
prefix No Specify the target path for decompressed files, must be UrlEncoded. By default, files are extracted to the current archive’s directory.

Note: If you need to delete the source file, you must have deleteObject permission.

Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!