Todos los productos
Search
Centro de documentos

Object Storage Service:ListBuckets (GetService)

Última actualización: Sep 03, 2026

Enumera todos los buckets propiedad de su cuenta de Alibaba Cloud. Puede filtrar los resultados por prefijo, marcador o número máximo de claves.

Notas de uso

Para listar los buckets de Object Storage Service (OSS), debe contar con el permiso oss:ListBuckets.

Para obtener más información, consulte Grant a custom policy.

Sintaxis de la solicitud

GET / HTTP/1.1
Host: oss.example.com
Date: GMT Date
Authorization: SignatureValue

Encabezados de solicitud

Encabezado

Tipo

Obligatorio

Ejemplo

Descripción

x-oss-resource-group-id

String

No

rg-aek27tc****

El ID del resource group.

  • Si se establece un ID de resource group, devuelve los buckets de dicho resource group.

    Si se establece rg-default-id, devuelve los buckets del resource group predeterminado.

  • Si se incluye sin valor, devuelve los buckets del resource group predeterminado.

  • Si se omite, devuelve todos los buckets de su cuenta de Alibaba Cloud.

Obtenga el ID del resource group desde la consola de Resource Management o mediante la llamada a ListResourceGroups. Para obtener más información, consulte View a resource group y ListResourceGroups.

Para obtener más información sobre otros encabezados de solicitud comunes incluidos en una petición de ListBuckets (GetService), como Host y Date, consulte Common request headers.

Parámetros de solicitud

Encabezado

Tipo

Obligatorio

Ejemplo

Descripción

prefix

String

No

my

El prefijo que deben contener los nombres de bucket devueltos. Si no se especifica este parámetro, no se utilizan prefijos para filtrar los buckets devueltos.

Valor predeterminado: vacío.

marker

String

No

mybucket10

El nombre del bucket a partir del cual comienza el listado. Se devuelven los buckets que siguen alfabéticamente a este valor. Si no se especifica este parámetro, se devuelven todos los buckets.

Valor predeterminado: vacío.

max-keys

Integer

No

10

El número máximo de buckets que se devolverán.

Valores válidos: de 1 a 1000.

Valor predeterminado: 100.

Encabezados de respuesta

Todos los encabezados en la respuesta a una solicitud de ListBuckets (GetService) son encabezados de respuesta comunes. Para obtener más información, consulte Common response headers.

Elementos de respuesta

Nota

La respuesta XML de ListBuckets (GetService) omite Prefix, Marker, MaxKeys, IsTruncated y NextMarker cuando se devuelven todos los buckets.

Encabezado

Tipo

Ejemplo

Descripción

ListAllMyBucketsResult

Container

N/A

El contenedor raíz para los resultados de ListBuckets (GetService).

Nodos secundarios: Owner y Buckets

Nodos primarios: ninguno

Prefix

String

my

El prefijo utilizado para filtrar los buckets devueltos.

Nodos primarios: ListAllMyBucketsResult

Marker

String

mybucket

El nombre del bucket donde comienza el listado de ListBuckets (GetService).

Nodos primarios: ListAllMyBucketsResult

MaxKeys

String

10

El número máximo de buckets devueltos.

Nodos primarios: ListAllMyBucketsResult

IsTruncated

Enumerated string

true

Indica si se han devuelto todos los resultados. Valores válidos:

  • true: No se han devuelto todos los resultados.

  • false: Se han devuelto todos los resultados.

Nodos primarios: ListAllMyBucketsResult

NextMarker

String

mybucket10

El marcador de paginación para recuperar los resultados restantes.

Nodos primarios: ListAllMyBucketsResult

Owner

Container

N/A

El contenedor para los detalles del propietario del bucket.

Nodos primarios: ListAllMyBucketsResult

ID

String

ut_test_put_bucket

El ID de usuario del propietario del bucket.

Nodos primarios: ListAllMyBucketsResult.Owner

DisplayName

String

ut_test_put_bucket

El nombre para mostrar del propietario del bucket, que es igual al ID de usuario.

Nodos primarios: ListAllMyBucketsResult.Owner

Buckets

Container

N/A

El contenedor para varias entradas de bucket.

Nodos secundarios: Bucket

Nodos primarios: ListAllMyBucketsResult

Bucket

Container

N/A

El contenedor para los detalles de un bucket individual.

Nodos secundarios: Name, CreationDate y Location

Nodos primarios: ListAllMyBucketsResult.Buckets

Name

String

mybucket01

El nombre del bucket.

Nodos primarios: ListAllMyBucketsResult.Buckets.Bucket

CreationDate

Time

2014-05-15T11:18:32.000Z

La hora de creación del bucket. Formato: yyyy-mm-ddThh:mm:ss.timezone.

Nodos primarios: ListAllMyBucketsResult.Buckets.Bucket

Location

String

oss-cn-hangzhou

El ID de región de OSS.

Nodos primarios: ListAllMyBucketsResult.Buckets.Bucket

ExtranetEndpoint

String

oss-cn-hangzhou.aliyuncs.com

El endpoint público del bucket.

Nodos primarios: ListAllMyBucketsResult.Buckets.Bucket

IntranetEndpoint

String

oss-cn-hangzhou-internal.aliyuncs.com

El endpoint interno del bucket.

Nodos primarios: ListAllMyBucketsResult.Buckets.Bucket

Region

String

cn-hangzhou

El ID de región de Alibaba Cloud.

Nodos primarios: ListAllMyBucketsResult.Buckets.Bucket

StorageClass

String

Standard

La clase de almacenamiento del bucket. Valores válidos: Standard, IA, Archive, ColdArchive y DeepColdArchive.

Nodos primarios: ListAllMyBucketsResult.Buckets.Bucket

ResourceGroupId

String

rg-aek27tc****

El ID del resource group del bucket. Los buckets del resource group predeterminado devuelven rg-default-id.

Nodos primarios: ListAllMyBucketsResult.Buckets.Bucket

Ejemplos

  • Listar todos los buckets de su cuenta

    Solicitudes de ejemplo

    GET / HTTP/1.1
    Date: Thu, 15 May 2014 11:18:32 GMT
    Host: oss-cn-hangzhou.aliyuncs.com
    Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=host,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e

    Respuestas exitosas de ejemplo

    HTTP/1.1 200 OK
    Date: Thu, 15 May 2014 11:18:32 GMT
    Content-Type: application/xml
    Content-Length: 556
    Connection: keep-alive
    Server: AliyunOSS
    x-oss-request-id: 5374A2880232A65C2300****
    <?xml version="1.0" encoding="UTF-8"?>
    <ListAllMyBucketsResult>
      <Owner>
        <ID>512**</ID>
        <DisplayName>51264</DisplayName>
      </Owner>
      <Buckets>
        <Bucket>
          <CreationDate>2014-02-17T18:12:43.000Z</CreationDate>
          <ExtranetEndpoint>oss-cn-shanghai.aliyuncs.com</ExtranetEndpoint>
          <IntranetEndpoint>oss-cn-shanghai-internal.aliyuncs.com</IntranetEndpoint>
          <Location>oss-cn-shanghai</Location>
          <Name>app-base-oss</Name>
          <Region>cn-shanghai</Region>
          <StorageClass>Standard</StorageClass>
        </Bucket>
        <Bucket>
          <CreationDate>2014-02-25T11:21:04.000Z</CreationDate>
          <ExtranetEndpoint>oss-cn-hangzhou.aliyuncs.com</ExtranetEndpoint>
          <IntranetEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</IntranetEndpoint>
          <Location>oss-cn-hangzhou</Location>
          <Name>mybucket</Name>
          <Region>cn-hangzhou</Region>
          <StorageClass>IA</StorageClass>
        </Bucket>
      </Buckets>
    </ListAllMyBucketsResult>
  • Listar buckets por prefijo y número máximo de claves

    Solicitudes de ejemplo

    GET /?prefix=my&max-keys=10 HTTP/1.1
    Date: Thu, 15 May 2014 11:18:32 GMT
    Host: oss-cn-hangzhou.aliyuncs.com
    Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=host,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e

    Respuestas exitosas de ejemplo

    HTTP/1.1 200 OK
    Date: Thu, 15 May 2014 11:18:32 GMT
    Content-Type: application/xml
    Content-Length: 545
    Connection: keep-alive
    Server: AliyunOSS
    x-oss-request-id: 5374A2880232A65C2300****
    <?xml version="1.0" encoding="UTF-8"?>
    <ListAllMyBucketsResult>
      <Prefix>my</Prefix>
      <Marker>mybucket</Marker>
      <MaxKeys>10</MaxKeys>
      <IsTruncated>true</IsTruncated>
      <NextMarker>mybucket10</NextMarker>
      <Owner>
        <ID>ut_test_put_bucket</ID>
        <DisplayName>ut_test_put_bucket</DisplayName>
      </Owner>
      <Buckets>
        <Bucket>
          <CreationDate>2014-05-14T11:18:32.000Z</CreationDate>
          <ExtranetEndpoint>oss-cn-hangzhou.aliyuncs.com</ExtranetEndpoint>
          <IntranetEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</IntranetEndpoint>
          <Location>oss-cn-hangzhou</Location>
          <Name>mybucket01</Name>
          <Region>cn-hangzhou</Region>
          <StorageClass>Standard</StorageClass>
        </Bucket>
      </Buckets>
    </ListAllMyBucketsResult>
  • Listar buckets en un resource group específico

    Solicitudes de ejemplo

    GET / HTTP/1.1
    Date: Thu, 15 May 2014 11:18:32 GMT
    Host: oss-cn-hangzhou.aliyuncs.com
    Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=host,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
    x-oss-resource-group-id: rg-aek27tc********

    Respuestas exitosas de ejemplo

    HTTP/1.1 200 OK
    Date: Thu, 15 May 2014 11:18:32 GMT
    Content-Type: application/xml
    Content-Length: 556
    Connection: keep-alive
    Server: AliyunOSS
    x-oss-request-id: 5374A2880232A65C2300****
    <?xml version="1.0" encoding="UTF-8"?>
    <ListAllMyBucketsResult>
      <Owner>
        <ID>512**</ID>
        <DisplayName>51264</DisplayName>
      </Owner>
      <Buckets>
        <Bucket>
          <CreationDate>2014-02-07T18:12:43.000Z</CreationDate>
          <ExtranetEndpoint>oss-cn-shanghai.aliyuncs.com</ExtranetEndpoint>
          <IntranetEndpoint>oss-cn-shanghai-internal.aliyuncs.com</IntranetEndpoint>
          <Location>oss-cn-shanghai</Location>
          <Name>test-bucket-1</Name>
          <Region>cn-shanghai</Region>
          <StorageClass>Standard</StorageClass>
          <ResourceGroupId>rg-aek27tc********</ResourceGroupId>
        </Bucket>
        <Bucket>
          <CreationDate>2014-02-05T11:21:04.000Z</CreationDate>
          <ExtranetEndpoint>oss-cn-hangzhou.aliyuncs.com</ExtranetEndpoint>
          <IntranetEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</IntranetEndpoint>
          <Location>oss-cn-hangzhou</Location>
          <Name>test-bucket-2</Name>
          <Region>cn-hangzhou</Region>
          <StorageClass>IA</StorageClass>
          <ResourceGroupId>rg-aek27tc********</ResourceGroupId>
        </Bucket>
      </Buckets>
    </ListAllMyBucketsResult>
  • Listar buckets en el resource group predeterminado

    Solicitudes de ejemplo

    GET / HTTP/1.1
    Date: Thu, 15 May 2014 11:18:32 GMT
    Host: oss-cn-hangzhou.aliyuncs.com
    Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=host,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
    x-oss-resource-group-id: rg-default-id 

    Respuestas exitosas de ejemplo

    HTTP/1.1 200 OK
    Date: Thu, 15 May 2014 11:18:32 GMT
    Content-Type: application/xml
    Content-Length: 556
    Connection: keep-alive
    Server: AliyunOSS
    x-oss-request-id: 5374A2880232A65C2300****
    <?xml version="1.0" encoding="UTF-8"?>
    <ListAllMyBucketsResult>
      <Owner>
        <ID>512**</ID>
        <DisplayName>51264</DisplayName>
      </Owner>
      <Buckets>
        <Bucket>
          <CreationDate>2014-02-07T18:12:43.000Z</CreationDate>
          <ExtranetEndpoint>oss-cn-shanghai.aliyuncs.com</ExtranetEndpoint>
          <IntranetEndpoint>oss-cn-shanghai-internal.aliyuncs.com</IntranetEndpoint>
          <Location>oss-cn-shanghai</Location>
          <Name>test-bucket-3</Name>
          <Region>cn-shanghai</Region>
          <StorageClass>Standard</StorageClass>
          <ResourceGroupId>rg-default-id</ResourceGroupId>
        </Bucket>
        <Bucket>
          <CreationDate>2014-02-05T11:21:04.000Z</CreationDate>
          <ExtranetEndpoint>oss-cn-hangzhou.aliyuncs.com</ExtranetEndpoint>
          <IntranetEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</IntranetEndpoint>
          <Location>oss-cn-hangzhou</Location>
          <Name>test-bucket-4</Name>
          <Region>cn-hangzhou</Region>
          <StorageClass>IA</StorageClass>
          <ResourceGroupId>rg-default-id</ResourceGroupId>
        </Bucket>
      </Buckets>
    </ListAllMyBucketsResult>

SDK

Puede utilizar los SDK de OSS para los siguientes lenguajes de programación a fin de invocar ListBuckets (GetService):

ossutil

Para obtener información sobre el comando de ossutil correspondiente a la operación ListBuckets, consulte list-buckets (get-service).

Códigos de error

Código de error

Código de estado HTTP

Descripción

AccessDenied

403

La solicitud proviene de un usuario anónimo y no incluye información de autenticación de usuario.