View bucket list
Updated at:2025-11-03
View bucket list
-
Basic workflow
- Create a BosClient instance.
- Run the listBuckets() method.
-
Example code
The following code can list all buckets of a user:
JavaScript1client.listBuckets() 2 .then(function(response) { 3 (response.body.buckets || []).forEach(function (bucket) { console.log(bucket.name) }) 4 }) 5 .catch(function() { 6 // Query failed, add your own code to handle the exception 7 }); - Response parameters
The parameters available for calling in the parsing class returned by the listBuckets method are as follows:
| Parameters | Description |
|---|---|
| owner | Bucket owner information |
| +id | User ID of bucket owner |
| +displayName | Name of bucket owner |
| buckets | Container storing the information of multiple buckets |
| bucket | Container storing the information of a bucket |
| +name | Bucket name |
| +createDate | Bucket creation time |
| +location | Region to which a bucket belongs |
