Arjun Chaudhary Arjun Chaudhary - 1 year ago 58
reST (reStructuredText) Question

I want to list all the subfolder inside a container using azure storage api

I have a hierarchy

my container
--images
--img01
--img02


I want to make a rest request and get the result:
<BlobPrefix>images</BlobPrefix>


As shown at this link https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/enumerating-blob-resources under the section "Delimited Blob List"

But, I am not getting this result instead of i am getting all the resources names as a recursive calls. As though I am not supplying any delimiter.

String to Sign is:

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 I am sending:

http://account.blob.core.windows.net/mycontainer?restype=container&comp=list&delimeter=/&maxresults=4


In result I am getting:

<xml>
<blobs>
<blob><Name>images/img01</Name>
<blob><Name>images/img02</Name>
</blobs>
</xml>


However based on above mentioned link. The response should be:

<xml>
<blobs>
<BlobPrefix>
<Name>images/</Name>
</BlobPrefix >
</xml>

Answer Source

According to your description, I checked Delimited Blob List and tested this method on my side. To simplify this issue, I created a container and set "Container Public Access Level" to "Public read access for container and blobs". Here is the file structure of my blob container:

  • List blobs without specifying the delimeter ('/' by default)

https://brucechen.blob.core.windows.net/brucechen?restype=container&comp=list

Result:

  • List blobs by specifying the delimeter ('/' by default)

https://brucechen.blob.core.windows.net/brucechen?restype=container&comp=list&delimiter=%2F

Result:

According to your stringToSign, the name of delimeter is incorrect, you need to change it to delimiter. For more details, you could refer to List Blobs.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download