You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Basic Bucket Operations
ListObjects
Copy page
Download PDF
ListObjects

Function description

This interface lists the objects in the bucket.
You need read access to the bucket to call this interface. Each request returns a portion of the bucket's objects (up to 1,000 per request). You can use request parameters as filters to return a subset of objects in the bucket.

tip

For a better user experience, we recommend prioritizing the use of the new
ListObjectsV2 interface when developing applications. To maintain backward compatibility, TOS will continue to support ListObjects.

Request syntax

GET / HTTP/1.1 
Host: bucketname.tos-cn-beijing.volces.com 
Date: GMT Date 
Authorization: authorization string

Request parameters and headers

This request uses the public request header, see Common parameters.

NameLocationTypeRequiredSample ValueDescription
delimiterQueryStringNo-Character used to group object names. Usually use / as the grouping character.

encoding-type

Query

String

No

url

Specify the encoding type for the returned content. The values are as follows:

  • url: perform URLEncode following the application/x-www-form-urlencoded standard.
max-keysQueryIntegerNo100Maximum number of objects to return. The maximum value is 1000, meaning up to 1000 objects can be returned per request.
prefixQueryStringNoabcList objects with a specified prefix.
markerQueryStringNotest.txtList the starting position of the objects. Set the value after which the object list is returned in alphabetical order. Usually the NextMarker value from the previous response body.

Request body elements

There is no message element in this request response.

Response headers

This request returns the common response message headers, please see common parameters.

Response body elements

NameTypeSample ValueDescription
NameStringtest-bucketBucket name.
PrefixStringabcprefix parameter included in the request
MarkerStringabcmarker parameter included in the request
MaxKeysInteger100max-keys parameter included in the request
DelimiterStringdDelimiter parameter included in the request.
EncodingTypeStringurlEncoding-type parameter included in the request.

IsTruncated

Bool

true

Whether the returned result is truncated, the value explanations are as follows:

  • false: all results have been returned.
  • true: there are more results not yet returned.
NextMarkerStringabcdIf the results are not fully returned, it indicates the marker value for the next request.
CommonPrefixesArray[{"Prefix": "abcd"}]When the delimiter parameter is included in the request, the response contains CommonPrefixes grouping information. This element identifies a set of object names that end with the delimiter and share a common prefix.
ContentsArray-The root node of the object information.
KeyStringabcdeObject name. The parent node is Contents.
LastModifiedString2024-06-06T07:15:20.000ZThe last modification time of the object. The parent node is Contents.
ETagString"32185e15494ca8e0eedf12bd218787f6"Generated when each object is created, uniquely identifying the content of the object. The parent node is Contents.
SizeInteger4813Object size. The parent node is Contents.

StorageClass

String

STANDARD

Object storage types,For detailed information, please refer to Storage type.
The parent node is Contents.

Type

String

Appendable

If the object is not a Normal object, this element will be returned with the following value explanation:

  • Appendable: this object is uploaded via the append write interface.
  • Symlink: this object is a symbolic link.

The parent node is Contents.

HashCrc64ecma

String

2217460101204276403

Represents the 64-bit CRC value of the object. The 64-bit CRC is calculated according to the ECMA-182 standard.

If the object was created before the TOS server supported 64-bit CRC verification, this header will not appear in the response message.

The parent node is Contents.

OwnerObject-Object owner. The parent node is Contents.
IDString1234567890Account ID. The parent node is Owner.
DisplayNameStringtest-owner-nameAccount name. The parent node is Owner.

Sample request

GET / HTTP/1.1 
Host: bucketname.tos-cn-beijing.volces.com 
Date: Fri, 30 Jul 2021 08:05:36 GMT 
Authorization: authorization string

Sample response

HTTP/1.1 200 OK 
x-tos-id-2: dc13a2093d620014-a444ed0 
x-tos-request-id: dc13a2093d620014-a444ed0 
Date: Fri, 30 Jul 2021 06:45:39 GMT 
server: TosServer 
Content-Length: 622 

{ 
    "Name": "bucketName", 
    "Prefix": "", 
    "Marker": "", 
    "MaxKeys": 1000, 
    "IsTruncated": false, 
    "Contents": [ 
        { 
            "Key": "obj1", 
            "LastModified": "2021-08-20T03:10:02.000Z", 
            "ETag": ""8a36be0d764367db4eea2deb16b71543"", 
            "Size": 109, 
            "StorageClass": "STANDARD" 
        }, 
        { 
            "Key": "obj2", 
            "LastModified": "2021-08-20T03:10:06.000Z", 
            "ETag": ""8a36be0d764367db4eea2deb16b71543"", 
            "Size": 109, 
            "StorageClass": "STANDARD" 
        }, 
        { 
            "Key": "obj3", 
            "LastModified": "2021-08-20T03:10:10.000Z", 
            "ETag": ""8a36be0d764367db4eea2deb16b71543"", 
            "Size": 109, 
            "StorageClass": "STANDARD" 
        } 
    ] 
}
Last updated: 2025.06.30 17:27:07