Help Center/ SparkRTC/ API Reference/ OBS Bucket Management/ Listing Objects in an OBS Bucket
Updated on 2026-04-27 GMT+08:00

Listing Objects in an OBS Bucket

Function

This API is used to list objects in an OBS bucket.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

URI

GET /v2/rtc-ops/buckets/objects

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

bucket

Yes

String

Name of the bucket to be queried.

prefix

No

String

Object name prefix, which can be regarded as a folder path.

type

Yes

String

Query type. Options:

folders: queries directories.

objects: queries objects.

location

Yes

String

Region where the bucket is located:

  • cn-north-4

  • cn-north-1

  • cn-north-5

  • cn-north-6

  • cn-south-1

  • cn-east-2

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API that is used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 4 Response body parameters

Parameter

Type

Description

count

Integer

Total number of objects.

objects

Array of ObsObject objects

OBS files.

Table 5 ObsObject

Parameter

Type

Description

file_name

String

Object name.

size

Integer

File size, in unit of KB.

last_modified

String

Last modification time, for example, 2020/07/16 15:11:55 GMT+08:00.

Status code: 401

Table 6 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Description.

Status code: 404

Table 8 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Description.

Status code: 500

Table 10 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Description.

Example Requests

None

Example Responses

Status code: 200

Objects in an OBS bucket listed.

{
  "count" : 1,
  "objects" : [ {
    "file_name" : "test file"
  }, {
    "size" : 7254700
  }, {
    "last_modified" : "20230815085859"
  } ]
}

Status code: 401

Request failed due to an incorrect X-Auth-Token.

{
  "error_code" : "RTC.00001003",
  "error_msg" : "InvalidParameterValue"
}

Status code: 404

Query failed. Task ID not found.

{
  "error_code" : "RTC.00001003",
  "error_msg" : "InvalidParameterValue"
}

Status code: 500

Query failed due to a server error.

{
  "error_code" : "RTC.00002xxx",
  "error_msg" : "InternalError"
}

Status Codes

Status Code

Description

200

Objects in an OBS bucket listed.

401

Request failed due to an incorrect X-Auth-Token.

404

Query failed. Task ID not found.

500

Query failed due to a server error.

Error Codes

See Error Codes.