All Products
Search
Document Center

Object Storage Service:GetBucketInventory

Last Updated:Mar 21, 2025

Queries the specified inventories of a bucket.

Usage notes

By default, an Alibaba Cloud account has the permission to query the specified inventories of a bucket. If you want to query the specified inventories of a bucket by using a RAM user or STS, you must have the oss:GetBucketInventory permission.

Request syntax

GET /?inventory&inventoryId=inventoryId HTTP/1.1

Request parameters

Parameter

Type

Required

Description

inventoryId

String

Yes

The ID of the inventory that you want to query.

Response parameters

Parameter

Type

Description

Id

String

The specified inventory name, which must be globally unique in the bucket.

IsEnabled

Boolean value

Indicates whether the inventory feature is enabled.

Valid values: true and false

  • A value of true indicates that the inventory feature is enabled.

  • A value of false indicates that no inventory list is generated.

Filter

Container

The container that stores the prefix used to filter objects. Only objects whose names contain the specified prefix are included in the inventory list.

Prefix

String

The prefix that is specified in the inventory.

Parent nodes: Filter

Destination

Container

The container that stores information about exported inventory lists.

OSSBucketDestination

Container

The information about the bucket that stores the exported inventory lists.

Parent nodes: Destination

Format

String

The format of the exported inventory lists.

Valid value: CSV

Parent nodes: OSSBucketDestination

AccountId

String

The account ID granted by the bucket owner.

Parent nodes: OSSBucketDestination

RoleArn

String

The name of the role to which the bucket owner grants permissions.

Format: acs:ram::uid:role/rolename

Parent nodes: OSSBucketDestination

Bucket

String

The bucket in which the exported inventory lists are stored.

Parent nodes: OSSBucketDestination

Prefix

String

The prefix contained in the path in which the exported inventory lists are stored.

Parent nodes: OSSBucketDestination

Encryption

Container

The container that stores the encryption method of exported inventory lists.

Valid values: SSE-OSS, SSE-KMS, and Null

Parent nodes: OSSBucketDestination

SSE-OSS

Container

The container that stores the information about the SSE-OSS encryption method.

Parent nodes: Encryption

SSE-KMS

Container

The container that stores the customer master key (CMK) used in the SSE-KMS encryption method.

Parent nodes: Encryption

KeyId

String

The ID of the key that is managed by Key Management Service (KMS).

Parent nodes: SSE-KMS

Schedule

Container

The container that stores information about the frequency at which inventory lists are exported.

Frequency

String

The frequency at which inventory lists are exported.

Valid values: Daily and Weekly

Parent nodes: Schedule

IncludedObjectVersions

String

Indicates whether to include the version information about objects in inventory lists.

Valid values: All and Current

  • A value of All indicates that all versions of the objects are exported.

  • A value of Current indicates that only the current versions of the objects are exported.

OptionalFields

Container

The container that stores the configuration fields included in the inventory lists.

Field

String

The configuration fields that are included in inventory lists.

Valid values: Size, LastModifiedDate, ETag, StorageClass, IsMultipartUploaded, and EncryptionStatus

Parent nodes: OptionalFields

Examples

  • Sample requests

    GET /?inventory&inventoryId=list1 HTTP/1.1
  • Sample responses

      HTTP/1.1 200 OK
      x-oss-request-id: 56594298207FB304438516F9
      Date: Mon, 31 Oct 2016 12:00:00 GMT
      Server: AliyunOSS
      Content-Length: length
    
      <?xml version="1.0" encoding="UTF-8"?>
      <InventoryConfiguration>
         <Id>report1</Id>
         <IsEnabled>true</IsEnabled>
         <Destination>
            <OSSBucketDestination>
               <Format>CSV</Format>
               <AccountId>1000000000000000</AccountId>
               <RoleArn>acs:ram::1000000000000000:role/AliyunOSSRole</RoleArn>
               <Bucket>acs:oss:::bucket_0001</Bucket>
               <Prefix>prefix1</Prefix>
               <Encryption>
                  <SSE-OSS/>
               </Encryption>
            </OSSBucketDestination>
         </Destination>
         <Schedule>
            <Frequency>Daily</Frequency>
         </Schedule>
         <Filter>
           <Prefix>myprefix/</Prefix>
         </Filter>
         <IncludedObjectVersions>All</IncludedObjectVersions>
         <OptionalFields>
            <Field>Size</Field>
            <Field>LastModifiedDate</Field>
            <Field>ETag</Field>
            <Field>StorageClass</Field>
            <Field>IsMultipartUploaded</Field>
            <Field>EncryptionStatus</Field>
         </OptionalFields>
      </InventoryConfiguration>

OSS SDKs

You can use OSS SDKs for the following programming languages to call GetBucketInventory:

ossutil

For information about the ossutil command that corresponds to the GetBucketInventory operation, see get-bucket-inventory.