Skip to main content

Listing a Bucket's Contents

Listing a Bucket's content is a fundamental command to see what currently exists utilizing ListObjectsV2.

List Bucket

To create a bucket using QConsole:

  1. Log in to your QConsole account
  2. Navigate to the QStorage service section
  3. Select the relavant bucket
  4. You should see a list of the bucket's content by Object name.

Your new bucket will appear in the bucket list and is immediately available for use.

Filter Object Return Output

You can additionally use the --query argument to filter the output of list-objects down to the key value and size for each object:

qcli s3api list-objects --bucket qstorage-demo-bucket --query 'Contents[].{Key: Key, Size: Size}'

This should reduce the size of your output (and response size) to only what you need for your subsequent commands.

Filter Objects By MetaData

If you have user-defined data, you have to list your bucket contents for the keys:

qcli s3api list-objects --bucket bucket-name --query 'Contents[].{Key: Key}'

then loop through the Object's keys using the HEAD API request for each Object to get the metadata and then filter by the Tags and their respective Values in your application's language.


## Success
When complete you should see a response of:
```json
{
"Contents": [
{
"Key": "TEST",
"LastModified": "2025-04-05T00:01:33+00:00",
"ETag": "\"98fe4eeb7a37b06cc47b4ad1d4c18b0d\"",
"Size": 61,
"StorageClass": "STANDARD",
"Owner": {
"DisplayName": "test-admin",
"ID": "test-admin"
}
}
],
"RequestCharged": null,
"Prefix": ""
}

Success With Query

[
{
"Key": "TEST",
"Size": 61
}
]

Success with Empty Bucket

null