All Products
Search
Document Center

ENS:ListObjects

Last Updated:Mar 12, 2024

Lists all objects in a bucket.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
BucketNamestringYes

The name of the bucket.

test
EncodingTypestringNo

The encoding type of the object names in the response. Only URL encoding is supported.

url
MarkerstringNo

The position from which the list operation starts. The name of the object after which the list operation starts. If this parameter is specified, objects whose names are alphabetically greater than the value of Marker are returned. The Marker parameter is used to list the returned objects by page, and its value must be less than 1,024 bytes in length.

Even if the value specified for Marker does not exist in the list during a conditional query, the list starts from the object whose name is alphabetically greater than the value of Marker.

a
MaxKeyslongNo

The maximum number of objects to return.

Valid values: 0 to 1000. Default value: 100.

100
PrefixstringNo

The prefix that must be included in the names of objects you want to list. If you specify a prefix to query objects, the returned object names contain the prefix.

The value of the parameter must be less than 1,000 bytes in length.

b
ContinuationTokenstringNo

The token used in this list operation. If the number of objects exceeds the value of MaxKeys, the NextContinuationToken is included in the response as the token for the next list operation.

test1.txt
StartAfterstringNo

The position from which the list operation starts. The name of the object after which the list operation starts. If this parameter is specified, objects whose names are alphabetically greater than the value of StartAfter are returned. The StartAfter parameter is used to list the returned objects by page, and its value must be less than 1,000 bytes in length.

Even if the value specified for StartAfter does not exist in the list during a conditional query, the list starts from the object whose name is alphabetically greater than the value of StartAfter.

b

Response parameters

ParameterTypeDescriptionExample
object
CommonPrefixesarray

The container for all object names between Prefix and the next occurrence of the string specified by a delimiter. A response can contain CommonPrefixes only if you specify a delimiter.

string

The container for all object names between Prefix and the next occurrence of the string specified by a delimiter. A response can contain CommonPrefixes only if you specify a delimiter.

N/A
NextContinuationTokenstring

The token used in the next list operation.

CgJiYw--
ContinuationTokenstring

The token used in this list operation.

test1.txt
Delimiterstring

The character used to group objects by name.

/
EncodingTypestring

The encoding type of the object names in the response.

N/A
Prefixstring

The prefix contained in the names of returned objects.

b
Markerstring

The position from which the list operation starts.

ceshi.txt1617853707991
BucketNamestring

The name of the bucket.

test
Contentsobject []

The list of object metadata.

Keystring

The name of the object.

ceshi.txt1617853706546
LastModifiedstring

The time when the object was last modified.

2021-04-08T03:48:47.488Z
ETagstring

The entity tag (ETag). When an object is created, an ETag is created to identify the content of the object.

  • For an object that is created by calling the PutObject operation, the ETag value of the object is the MD5 hash of the object content.
  • If an object is created by using other methods, the ETag value of the object is the UUID of the object content.
  • The ETag of an object can be used to check whether the object content is modified. However, we recommend that you use the MD5 hash of an object rather than the ETag value of the object to verify data integrity.
5B3C1A2E053D763E1B002CC607C5****
Sizelong

The size of the returned object. Unit: bytes.

15
IsTruncatedboolean

Indicates whether the listed objects are truncated. Valid values:

  • false
  • true
true
KeyCountlong

The number of objects returned for this request.

10
NextMarkerstring

The position from which the next list operation starts.

ceshi.txt1617853707991
MaxKeyslong

The maximum number of objects returned.

10
RequestIdstring

The ID of the request.

4833C4AC-9396-458C-8F25-1D701334E560

Examples

Sample success responses

JSONformat

{
  "CommonPrefixes": [
    "N/A"
  ],
  "NextContinuationToken": "CgJiYw--",
  "ContinuationToken": "test1.txt",
  "Delimiter": "/",
  "EncodingType": "N/A",
  "Prefix": "b",
  "Marker": "ceshi.txt1617853707991",
  "BucketName": "test",
  "Contents": [
    {
      "Key": "ceshi.txt1617853706546",
      "LastModified": "2021-04-08T03:48:47.488Z",
      "ETag": "5B3C1A2E053D763E1B002CC607C5****",
      "Size": 15
    }
  ],
  "IsTruncated": true,
  "KeyCount": 10,
  "NextMarker": "ceshi.txt1617853707991",
  "MaxKeys": 10,
  "RequestId": "4833C4AC-9396-458C-8F25-1D701334E560"
}

Error codes

HTTP status codeError codeError message
400Invalid%sSpecified parameter %s is not valid
400InvalidBucketNameSpecified parameter BucketName is not valid.
400InvalidPrefixSpecified parameter Prefix is not valid.
400InvalidStartAfterSpecified parameter StartAfter is not valid.
400InvalidMarkerSpecified parameter Marker is not valid.
400InvalidDelimiterSpecified parameter Delimiter is not valid.
400NoPermissionPermission denied.
400InvalidParameter.%sThe specified field %s invalid. Please check it again.
403AccessDeniedauth is not valid
404NoSuchBucketThe specified bucket does not exist.
500InternalErrorThe request processing has failed due to some unknown error.

For a list of error codes, visit the Service error codes.