Cloud API with JavaScript (Amazon, Azure) Cloud API with JavaScript (Amazon, Azure) azure azure

Cloud API with JavaScript (Amazon, Azure)


Windows Azure Blob Storage has the notion of a Shared Access Signature (SAS) which could be issued on the server-side and is essentially a special URL that a client could write to without having direct access to the storage account API key. This is the only mechanism in Windows Azure Storage that allows writing data without access to the storage account key.

A SAS can be expired (e.g., give user 10 minutes to use the SAS URL for an upload) and can be set up to allow for canceling access even after issue. Further, a SAS can be useful for time-limited read access (e.g., give user 1 day to watch this video).

If your JavaScript client is also running in a browser, you may indeed have cross-domain issues. I have two thoughts - neither tested! One thought is JSONP-style approach (though this will be limited to HTTP GET calls). The other (more promising) thought is to host the .js files in blob storage along with your data files so they are on same domain (hopefully making your web browser happy).

The "real" solution might be Cross-Origin Resource Sharing (CORS) support, but that is not available in Windows Azure Blob Storage, and still emerging (along with other HTML 5 goodness) in browsers.


Yes you can do this but you wouldn't want your azure key available on the client side for the javascript to be able to access the queue directly.

I would have the javascript talking to a web service which could check access rights for the user and allow/disallow the posting of a message to the queue.

So the javascript would only ever talk to the web services and leave the web services to handle talking to the queues.

Its a little too big a subject to post sample code but hopefully this is enough to get you started.


I think that the existing service providers do not allow you to query storage directly from the client. So in order to resolve the issues:

  1. you can write a simple Server and expose REST apis which authenticate based on the APIKey passed on as a request param and get your specific data back to your client.
  2. Have an embedded iframe and make the call to 2nd domain from the iframe. Get the returned JSON/XML on the parent frame and process the data.

Update: Looks like Google already solves your problem. Check this out.

On https://developers.google.com/storage/docs/json_api/v1/libraries check the Google Cloud Storage JSON API client libraries section.