List Resources

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

List Resources

Description

This interface provides to enumerate the resources in the specified space in batches on the cloud storage platform.

Request Description

GET /list?bucket=<bucket>&limit=<limit>&prefix=<Urlsafe_Base64_Encoded_Prefix>&mode=<mode>&marker=<marker>
Host:<MgrDomain>
Authorization:<AccessToken>

Header Description

Parameter Required Description
Host Yes The management domain name can be obtained on the user management interface.
Authorization Yes Manage credentials .

Parameter Description

Parameter Required Description
bucket Yes Specify the space.
limit no List the number of entries, in the range 1-1000. The default value is 1000.
prefix no Specify a prefix, and only resources whose filename matches the prefix will be listed. Default is empty. Strings need to be URL-safe Base64 encoded .
startTime no File upload start time, in the format of time difference accurate to milliseconds, such as 1526745600000 (2015/5/20 00:00:00).
endTime no File upload termination time, the format is the time difference accurate to milliseconds, such as 1527609600000 (2015/5/30 00:00:00).
mode no Specify the sorting method of the list: 0 means to list the files in the directory first; 1 means to list the folders in the directory first. When this Parameter is not specified, all files in the directory and files in subdirectories are listed according to the key order.
marker no The position mark returned from the last enumeration is used as the starting point information of this enumeration. Default is empty.

Note: The mode Parameter is used to simulate the file system. *

  • When specifying the mode Parameter, you can specify the query directory through the prefix Parameter. In this case, the prefix Parameter does not support fuzzy query.
  • When the mode Parameter is not specified, the prefix Parameter supports fuzzy query

Response Description

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

{
    "marker": "<marker string>",
    "commonPrefixes": [
        "xxx",
        "yyy"
    ],
    "items": [
        {
            "key":     "<key string>",
            "putTime":   <filePutTime long>,
            "hash":     "<fileETag string>",
            "fsize":     <fileSize string>,
            "mimeType": "<mimeType string>",
            "expirationDate":   "<expirationDate string>",
            "storageClass": "<storageClass>"
        },
        ...
    ]
}
Field name Required Description
marker Yes If there are remaining entries, a non-empty string is returned, which is passed in as the Parameter of the next column F. Returns an empty string if no entries remain.
commonPrefixes Yes An array of all directory names. If the mode Parameter is not specified, the field value is empty.
items Yes An array of all returned entries, or an empty array if no entries remain.
key Yes Resource name.
putTime Yes Upload time, in Unix format, in milliseconds.
fsize Yes The size of the resource content, in bytes.
hash Yes The ETag value of the resource content.
mimeType Yes The MIME type of the resource content.
expirationDate Yes File expiration time, in the format YYYYMMDDhhmmss. Note: The specific time when the file is cleaned up after expiration is subject to the execution of the server-side task. The time difference within one day is normal.
storageClass Yes File storage types, such as Standard – standard storage, IA – low frequency storage, Archive – archive storage.

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

{
    "code":     "<code string>",
    "message":  "<message string>"
}
Field name Required Description
code Yes HTTP request response code, see HTTP response status code
message Yes A prompt message for failure to enumerate resources

Example

curl -v -o filelist.json -H "Authorization:86622e227a50d49d858c2494a935bc2e4ac543a7:NTVjZWZmOThhYjUzMjhkMWQ3YzE3OGM0NTRhYzFmODc5MDQ0MWExNQ==" --url "http://mgrDomain/list?bucket=images&limit=10"
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!