調用ListObjects列出Bucket中的所有檔案(Object)的資訊。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
ens:ListObjects |
list |
*全部資源
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| BucketName |
string |
是 |
Bucket 名稱。 |
test |
| EncodingType |
string |
否 |
請求響應體中檔案名稱採用的編碼方式,目前僅支援 url。 |
url |
| Marker |
string |
否 |
此次列舉檔案的起點。設定從 Marker 之後按字母排序開始返回 Object。Marker 用來實現分頁顯示效果,參數的長度必須小於 1024 位元組。 做條件查詢時,即使 Marker 在列表中不存在,也會從符合 Marker 字母排序的下一個開始列印。 |
a |
| MaxKeys |
integer |
否 |
限定此次列舉檔案的最大個數。 取值範圍:0~1000(包含 1000),預設值為 100。 |
100 |
| Prefix |
string |
否 |
限定返回的檔案必須以 prefix 作為首碼。使用 Prefix 查詢時,返回的 Key 中仍會包含 Prefix。 參數的長度必須小於 1000 位元組。 |
b |
| ContinuationToken |
string |
否 |
此次列舉檔案使用的 continuationToken。如果 MaxKeys 的設定無法一次完成列舉,返回結果會附加 NextContinuationToken 作為下一次列舉的 ContinuationToken。 |
test1.txt |
| StartAfter |
string |
否 |
此次列舉檔案的起點。設定從 StartAfter 之後按字母排序開始返回 Object。StartAfter 用來實現分頁顯示效果,參數的長度必須小於 1000 位元組。 做條件查詢時,即使 StartAfter 在列表中不存在,也會從符合 StartAfter 字母排序的下一個開始列印。 |
b |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| CommonPrefixes |
array |
如果請求中指定了 Delimiter 參數,則會在返回的響應中包含 CommonPrefixes 元素。該元素表明以 Delimiter 結尾,並有共同首碼的 Object 名稱的集合。 |
|
|
string |
如果請求中指定了 Delimiter 參數,則會在返回的響應中包含 CommonPrefixes 元素。該元素表明以 Delimiter 結尾,並有共同首碼的 Object 名稱的集合。 |
不涉及 |
|
| NextContinuationToken |
string |
下次列舉檔案的 ContinuationToken。 |
CgJiYw-- |
| ContinuationToken |
string |
此次列舉檔案操作使用 ContinuationToken。 |
test1.txt |
| Delimiter |
string |
對檔案名稱進行分組的字元。 |
/ |
| EncodingType |
string |
指明返回結果中編碼使用的類型。 |
不涉及 |
| Prefix |
string |
本次查詢結果的首碼。 |
b |
| Marker |
string |
標明本次列舉檔案的起點。 |
ceshi.txt1617853707991 |
| BucketName |
string |
Bucket 名稱。 |
test |
| Contents |
array<object> |
Object 元資訊列表。 |
|
|
object |
|||
| Key |
string |
Object 名稱。 |
ceshi.txt1617853706546 |
| LastModified |
string |
Object 最後被修改的時間。 |
2021-04-08T03:48:47.488Z |
| ETag |
string |
ETag 在每個 Object 產生時建立,用於標識一個 Object 的內容。
|
5B3C1A2E053D763E1B002CC607C5**** |
| Size |
integer |
Object 的位元組數。 |
15 |
| IsTruncated |
boolean |
指明列舉檔案是否被截斷。
|
true |
| KeyCount |
integer |
此次請求返回的 Key 的個數。 |
10 |
| NextMarker |
string |
下一次列舉檔案的起點。 |
ceshi.txt1617853707991 |
| MaxKeys |
integer |
列舉檔案的最大個數。 |
10 |
| RequestId |
string |
請求 ID。 |
4833C4AC-9396-458C-8F25-1D701334E560 |
樣本
正常返回樣本
JSON格式
{
"CommonPrefixes": [
"不涉及"
],
"NextContinuationToken": "CgJiYw--",
"ContinuationToken": "test1.txt",
"Delimiter": "/",
"EncodingType": "不涉及",
"Prefix": "b",
"Marker": "ceshi.txt1617853707991",
"BucketName": "test",
"Contents": [
{
"Key": "ceshi.txt1617853706546",
"LastModified": "2021-04-08T03:48:47.488Z",
"ETag": "5B3C1A2E053D763E1B002CC607C5****",
"Size": 15
}
],
"IsTruncated": true,
"KeyCount": 10,
"NextMarker": "ceshi.txt1617853707991",
"MaxKeys": 10,
"RequestId": "4833C4AC-9396-458C-8F25-1D701334E560"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | Invalid%s | Specified parameter %s is not valid | |
| 400 | InvalidBucketName | Specified parameter BucketName is not valid. | 指定的BucketName參數無效。 |
| 400 | InvalidPrefix | Specified parameter Prefix is not valid. | |
| 400 | InvalidStartAfter | Specified parameter StartAfter is not valid. | |
| 400 | InvalidMarker | Specified parameter Marker is not valid. | |
| 400 | InvalidDelimiter | Specified parameter Delimiter is not valid. | |
| 400 | NoPermission | Permission denied. | |
| 400 | InvalidParameter.%s | The specified field %s invalid. Please check it again. | |
| 400 | InvalidArgument | Specified parameter ContinuationToken is incorrect. | 設定的ContinuationToken參數不正確。 |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | AccessDenied | auth is not valid | |
| 403 | UserDisable | The user has been disabled due to arrears. | 該使用者因欠費被禁用。 |
| 404 | NoSuchBucket | The specified bucket does not exist. | 請求的目標Bucket不存在。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。