Can I use Javascript call the Azure management REST API?

I want to use Azure Table storage REST api in javaScript. So I make call like this:

        type: "POST",

        beforeSend: function (request)
            request.setRequestHeader("contentType", "application/atom+xml;type=entry;charset=utf-8");
        url: "",
        contentType: "application/atom+xml",
        dataType: "jsonp",
        data: xmlString,
        success: function (xhr) {

I found the request type convert to get because jsonp not support post.. Then I found this threads:

How to upload a text string directly to Windows Azure Blob from the browser using javascript Accessing Windows Azure Queues from client side javascript/jquery

seems like if I host the webrole and tablestorage service with the same domain, I can use that code with datatype=xml.

How can I do that? Does is same domain? Or how can I use JS/JQuery call Azure mangement Rest API directly?



Currently you can't call Azure Management API directly using JavaScript because CORS is not supported in Windows Azure. Support for CORS is coming soon in Windows Azure Storage. Apart from CORS, Windows Azure Table Storage will also support returning the data in JSON format. Once those 2 things are in place, you should be able to accomplish this.

For now you would need to rely on some kind of middle layer (either as a Windows Azure Cloud service or a Windows Azure Websites) to which you'll send requests through your JavaScript application and then this middle layer will interact with the storage to get the data. Since Windows Azure Table Storage only returns the data in XML format, you would then convert that data into JSONP format and return back to the client.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.