1
votes

I'm trying to query an azure Blob Storage container from Silverlight.

I saw that the Windows.Azure.Storage.dll is not working with Silverlight so I presume the best way to communicate with my storage container is with REST Services. I saw the Azure Storage REST API, but I can't find an easy way to :

  • List all blobs in a container
  • Retrieve a blob from a container
  • Add a new blob in a container

Anyone have a clear example on how to do that (for a complete REST dummy)?

By the way, It has to be a private container.

Thanks

2

2 Answers

1
votes

Since you don't have access to the Microsoft.WindowsAzure.Storage assembly, you'll need to call the REST services directly.

The API is defined here:

http://msdn.microsoft.com/en-us/library/windowsazure/dd135733.aspx

This CodePlex project has some nice code samples that should help you get off the ground with the REST calls:

http://azurestoragesamples.codeplex.com/

1
votes

Adding one more option: Since you mentioned the blob containers are private, another option could be to use Shared Access Signatures (SAS) (https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-shared-access-signature-part-1/). Do take a look at this blog post series from Steve Marx where he demonstrated uploading blobs using Silverlight and Shared Access Signature: http://blog.smarx.com/posts/uploading-windows-azure-blobs-from-silverlight-part-1-shared-access-signatures. Once you have a SAS URI, you can simply use HttpWebRequest/HttpWebResponse to perform operations against your blob storage without going through implementing REST API.

For listing blobs, you would need "List" permission in your SAS. For fetching a blob, you would need "Read" permission in your SAS and for uploading a blob, you would need "Create" permission in your SAS.