Home > Blockchain >  Not able to retrieve list of files from container
Not able to retrieve list of files from container

Time:08-17

Problem

Error when I call the below GET api.

Does it have to do with that sr=d and sdd=4 in the url? I have another url where sr=c and has no sdd and that works when I make a GET request.

Endpoint GET Request

https://myaccount.blob.core.windows.net/xxx/yyy/zzz/xxx/yyy/?sp=rl&st=2022-08-01T12:19:00Z&se=2022-10-01T12:19:00Z&spr=https&sv=2021-06-08&sr=d&sig=xxxxxx&sdd=4&comp=list&restype=container

Error

<?xml version="1.0" encoding="utf-8"?>
<Error>
    <Code>InvalidUri</Code>
    <Message>The requested URI does not represent any resource on the server.
RequestId:1f1dda37-c01e-0118-457d-b24d16000000
Time:2022-08-16T14:35:50.3635803Z</Message>
</Error>

Expected Output

Able to list the files in the container

CodePudding user response:

Please change your request URL to

https://myaccount.blob.core.windows.net/xxx?sp=rl&st=2022-08-01T12:19:00Z&se=2022-10-01T12:19:00Z&spr=https&sv=2021-06-08&sr=d&sig=xxxxxx&sdd=4&comp=list&restype=container&prefix=yyy/zzz/xxx/yyy/

Above URL assumes that your container name is xxx and you want to list blobs in yyy/zzz/xxx/yyy/ virtual folder.

Also, your signed resource should be c (for blob container).

Please see this link for more details: https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs.

  • Related