Search code examples
azureazure-storageazure-blob-storageazure-container-serviceazure-rest-api

Rest API to get the list of files inside the container/directory/ in AZURE storage


I have a container called 'services'.Inside the Container , i have a directory called 'Test'.how we can get the list of blobs inside the directory test.I have few kept few CSVs inside the test. Need the rest api to get the list of the files. However i am able to get the list of items inside the container easily using below Rest API https://myaccount.blob.core.windows.net/services?restype=container&comp=list

i tried https://myaccount.blob.core.windows.net/services/Test?restype=directory&comp=list but it is not working. Please help to get the coorect param value or rest API to find the list of items inside the directory


Solution

  • https://myaccount.blob.core.windows.net/services/Test?restype=directory&comp=list&prefix=Test/
    

    The doc:

    https://learn.microsoft.com/en-us/rest/api/storageservices/list-blobs#uri-parameters

    Just add a param prefix is ok.