ListDatasets

更新时间:
复制 MD 格式

The ListDatasets operation lists the basic information of all datasets in a specified bucket. This operation supports filtering by name prefix and pagination.

Usage notes

  • By default, an Alibaba Cloud account can list datasets. If you call this operation as a RAM user, the RAM user must have the oss:MetaQuery permission.

  • Before you call this operation, you must enable metadata management for the bucket by calling the OpenMetaQuery operation.

  • A single call returns a maximum of 200 datasets, and 100 by default. If more results are available, use the nextToken parameter for pagination.

  • Each item in the list returns all fields of a dataset, including DatasetConfig, the backward-compatible WorkflowParameters, and DatasetMaxFileCount. For details about the fields, see Dataset data structure.

Request syntax

POST /?metaQuery&action=listDatasets HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Request header

This operation uses only common request headers. For more information, see Common request headers.

Request elements

Parameter

Type

Required

Example

Description

prefix

String

No

photos-

The prefix for filtering dataset names. The value must be URL-encoded if it contains non-ASCII characters.

maxResults

Integer

No

50

The maximum number of datasets to return. Valid values: 1 to 200. Default value: 100.

nextToken

String

No

MTIzNDU2

The pagination token. Omit this parameter for the first request. For subsequent requests, use the NextToken value from the previous response to retrieve the next page of results.

Response header

This operation uses only common response headers. For more information, see Common response headers.

Response elements

Parameter

Type

Required

Example

Description

ListDatasetsResponse

container

Yes

N/A

The root container for the response.

Child nodes: Datasets, NextToken

Datasets

container

Yes

N/A

The container for the list of datasets.

Child node: Dataset

Parent node: ListDatasetsResponse

Dataset

container

No

N/A

Information about a single dataset. For details, see Dataset data structure.

Parent node: Datasets

NextToken

String

No

MTIzNDU2

The pagination token for the next page of results. If no more results are available, this element is not returned or is empty.

Parent node: ListDatasetsResponse

Examples

Request example

Retrieve the first page:

POST /?metaQuery&action=listDatasets&maxResults=50 HTTP/1.1
Host: examplebucket.oss-cn-hangzhou.aliyuncs.com
Date: Wed, 20 May 2026 09:00:00 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20260520/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e

Retrieve the next page:

POST /?metaQuery&action=listDatasets&maxResults=50&nextToken=MTIzNDU2 HTTP/1.1
Host: examplebucket.oss-cn-hangzhou.aliyuncs.com
Date: Wed, 20 May 2026 09:00:10 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20260520/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e

Response example

HTTP/1.1 200 OK
x-oss-request-id: 64C8B6F4E7C5A3A8B9D6E7F5
Date: Wed, 20 May 2026 09:00:01 GMT
Content-Type: application/xml
Server: AliyunOSS

<?xml version="1.0" encoding="UTF-8"?>
<ListDatasetsResponse>
  <Datasets>
    <Dataset>
      <DatasetName>photos-default</DatasetName>
      <Description></Description>
      <CreateTime>2026-05-20T08:00:00.000+08:00</CreateTime>
      <UpdateTime>2026-05-20T08:00:00.000+08:00</UpdateTime>
      <DatasetMaxFileCount>100000000</DatasetMaxFileCount>
      <DatasetMaxEntityCount>10000000000</DatasetMaxEntityCount>
      <DatasetMaxRelationCount>100000000000</DatasetMaxRelationCount>
      <DatasetMaxTotalFileSize>90000000000000000</DatasetMaxTotalFileSize>
    </Dataset>
    <Dataset>
      <DatasetName>photos-2026</DatasetName>
      <Description>Photo gallery for 2026</Description>
      <CreateTime>2026-05-20T08:30:00.000+08:00</CreateTime>
      <UpdateTime>2026-05-20T08:30:00.000+08:00</UpdateTime>
      <DatasetMaxFileCount>100000000</DatasetMaxFileCount>
      <DatasetMaxEntityCount>10000000000</DatasetMaxEntityCount>
      <DatasetMaxRelationCount>100000000000</DatasetMaxRelationCount>
      <DatasetMaxTotalFileSize>90000000000000000</DatasetMaxTotalFileSize>
      <DatasetConfig>
        <Insights>
          <Language>zh-Hans</Language>
          <Video>
            <Caption>
              <Enable>True</Enable>
            </Caption>
          </Video>
        </Insights>
      </DatasetConfig>
    </Dataset>
  </Datasets>
  <NextToken>MTIzNDU2</NextToken>
</ListDatasetsResponse>