Compress Multiple File

Last update:2022-10-14 15:24:42

Uncompress Zip Package

Description

This interface provides the function of packaging and compressing specified multiple files on the cloud storage platform. Currently only ZIP compression is supported.

Request Description

POST /fmgr/compress
Host: <MgrDomain>
Authorization: <accessToken>

Header Description

Parameter Required Description
HOST Yes Management domain name , which can be obtained in the user management interface
Authorization Yes Manage Credentials

Parameter Description

Request parameters are organized in the following format and submitted as request content:

fops=bucket/<Urlsafe_Base64_Encoded_Bucket>/keys/<Urlsafe_Base64_Encoded_key1|Urlsafe_Base64_Encoded_key2|Urlsafe_Base64_Encoded_key3|……>/keyList/<Urlsafe_Base64_Encoded_keyList>/saveas/<Urlsafe_Base64_Encoded(<bucket:filekey>)>&notifyURL=<Urlsafe_Base64_Encoded_notifyUrl>&separate=<Separate>&force=<Force>
Parameter Required Description
fops Yes The processing parameter list, the format is the above description, supports multiple processing requests at the same time, and the parameter lists are separated by ;.
bucket Yes The storage space where the files to be compressed are located. <Urlsafe_Base64_Encoded_bucket> is the URL-safe Base64-encoded string for the specified bucket name.
keys Yes The files or directories to be compressed, and resources are separated by ¦. Note: 1. If the keyList parameter exists, this parameter can be left blank. 2. Ending with / indicates that the key value is a directory.
keyList Yes The index file path of the file or directory information to be compressed. When a large number of files or directories need to be compressed, the information to be compressed can be written into the index file line by line (without URL encoding), and then the index file is uploaded to the space. By specifying the path of the index file, the corresponding file and directory specified by the content of the index file can be compressed. . Note: If the keys parameter exists, this parameter can be left blank
saveas Yes The path to save the output file. The parameter needs to be filled with “space:filename” URL-safe Base64 encoded value
notifyURL no The processing result is notified of the receiving URL. For the format of the notification content, see the returned content of the task query interface .
separate no Whether processing instructions are notified separately. Set 1 and 0 as option codes: 1: Indicates that notifyURL is notified after each command is executed. 0: Indicates that notifyURL is notified once after all commands are executed . The default value is 0.
force no Whether to force processing. 1: Force data processing and overwrite the original result. 0: If the data processing result already exists, the processing is considered to be successful, and repeated processing is avoided to waste resources. The default value is 0.

Note:

  1. Fill in the keys and keyList parameters, and the keys parameter takes effect.
  2. If the specified part of the file or directory to be compressed does not exist or the directory is empty, the file or directory is ignored for compression; if the specified compressed file does not exist, the compression fails.
  3. keyList index file content format specification: one line (no URI encoding required) (UTF-8 encoding)
Example,test/keyList.txt have the information,the files as followings.
1.jpg
dir1/
2.jpg
test.jpg
……
Specified keyList为test/keyList.txt,showed as 1.jpg、dir1/、2.jpg、test.jpg、……” starting compress files.
  1. The original directory structure is preserved after compression. For example: there is a directory test/test1/, and there are test2 (empty directory) and 1.jpg, test3 directories (2.jpg files exist) in the test1 directory, and the directory test/test1/ is designated to be compressed into a.zip. After a.zip is decompressed, the directory structure is as follows:
test(directory)
|---test1(directory)
    |---1.jpg(file)
    |---test3(directory)
        |---2.jpg

Response Description

If the request is successful, a Jsonstring with the following content is returned:

{ "persistentId": <persistentId> }
Field name Required Description
persistentId Yes The task process ID, which can be used to query the task progress.

If the request fails, a Jsonstring with the following content is returned:

{
    "code":     "<code string>",
    "message":  "<ErrMsg string>"
}
Field name Required Description
code Yes HTTP request response code, see [ HTTP response status code
message Yes Request failed message

Example

curl -v -X POST -d "fops=bucket/bXlidWNrZXQ=/keys/MS5qcGc=|Mi5qcGc=|My5qcGc=/saveas/bXlidWNrZXQyOjEuemlw;bucket/bXlidWNrZXQ=/keyList/dGVzdC9jb21wcmVzcy50eHQ=/saveas/bXlidWNrZXQyOjIuemlw&notifyURL=aHR0cDovL3Rlc3QuY29tL25vdGlmeVVSbA==&separate=1&force=0" -H "Authorization:86622e227a50d49d858c2494a935bc2e4ac543a7:Y2JmMGY0YTNhZmQxZmVlZGM2ZTA0YTdjNTcyOWQ1NjRkNTExYjg0Yg==" --url "http://mgrDomain/fmgr/compress"
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!