我想使用 azure storage api 列出容器内的所有子文件夹
I want to list all the subfolder inside a container using azure storage api
我有等级制度
my container
--images
--img01
--img02
我想申请休息,得到结果:<BlobPrefix>images</BlobPrefix>
如图所示 link https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/enumerating-blob-resources 在 "Delimited Blob List"
部分下
但是,我没有得到这个结果,而是我得到了所有资源名称作为递归调用。好像我没有提供任何分隔符。
要签名的字符串是:
GET /account/mycontainer
x-ms-date:Tue, 07 Feb 2017 05:38:21 GMT
x-ms-version:2016-05-31
comp:list
delimeter:/
maxresults:4
restype:container
URL 我正在发送:
http://account.blob.core.windows.net/mycontainer?restype=container&comp=list&delimeter=/&maxresults=4
结果我得到:
<xml>
<blobs>
<blob><Name>images/img01</Name>
<blob><Name>images/img02</Name>
</blobs>
</xml>
然而基于上述link。响应应为:
<xml>
<blobs>
<BlobPrefix>
<Name>images/</Name>
</BlobPrefix >
</xml>
根据你的描述,我检查了Delimited Blob List并在我这边测试了这个方法。为了简化这个问题,我创建了一个容器并将 "Container Public Access Level" 设置为 "Public read access for container and blobs"。这是我的 blob 容器的文件结构:
- 不指定分隔符(默认为“/”)列出 blob
https://brucechen.blob.core.windows.net/brucechen?restype=container&comp=list
结果:
- 通过指定分隔符(默认为“/”)列出 blob
https://brucechen.blob.core.windows.net/brucechen?restype=container&comp=list&delimiter=%2F
结果:
根据您的stringToSign
,delimeter
的名称不正确,您需要将其更改为delimiter
。详情请参考List Blobs.
我有等级制度
my container
--images
--img01
--img02
我想申请休息,得到结果:<BlobPrefix>images</BlobPrefix>
如图所示 link https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/enumerating-blob-resources 在 "Delimited Blob List"
部分下但是,我没有得到这个结果,而是我得到了所有资源名称作为递归调用。好像我没有提供任何分隔符。
要签名的字符串是:
GET /account/mycontainer
x-ms-date:Tue, 07 Feb 2017 05:38:21 GMT
x-ms-version:2016-05-31
comp:list
delimeter:/
maxresults:4
restype:container
URL 我正在发送:
http://account.blob.core.windows.net/mycontainer?restype=container&comp=list&delimeter=/&maxresults=4
结果我得到:
<xml>
<blobs>
<blob><Name>images/img01</Name>
<blob><Name>images/img02</Name>
</blobs>
</xml>
然而基于上述link。响应应为:
<xml>
<blobs>
<BlobPrefix>
<Name>images/</Name>
</BlobPrefix >
</xml>
根据你的描述,我检查了Delimited Blob List并在我这边测试了这个方法。为了简化这个问题,我创建了一个容器并将 "Container Public Access Level" 设置为 "Public read access for container and blobs"。这是我的 blob 容器的文件结构:
- 不指定分隔符(默认为“/”)列出 blob
https://brucechen.blob.core.windows.net/brucechen?restype=container&comp=list
结果:
- 通过指定分隔符(默认为“/”)列出 blob
https://brucechen.blob.core.windows.net/brucechen?restype=container&comp=list&delimiter=%2F
结果:
根据您的stringToSign
,delimeter
的名称不正确,您需要将其更改为delimiter
。详情请参考List Blobs.