VENDITE: 1-800-867-1389

 none
Azure REST API

    Domanda

  • None of my REST API successfully executes and responds.

    Either I get 404 excpetion that URI not found etc or 400 Exceotion.

    I exactly follow the notes in the REST API provided on azure site, still not able to catch why none of requests working!

    I want information on my azure storage cloud information. like what is the total space used on the storage and what is left over

    mercoledì 14 marzo 2012 04:43

Tutte le risposte

  •  I am trying to enable storage analytics using REST API provided here:

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

    and i get Status code 404 for resource does not exist....

    Could anyone please help me on this?

    mercoledì 14 marzo 2012 05:10
  • Will it be possible for you to share your source code? That will help identify the problem. Also, please note that it may take some time for the analytics data to populate after enabling the analytics on your storage account. A good way to test would be to check the presence of tables and blob containers starting with "$" e.g. $logs blob container.

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

    mercoledì 14 marzo 2012 05:43
  • Hi,

    Can Azure Storage Explorer find your blob or table resources? Does your resources has been uploaded successfully?

    Following the Windows Azure Trainning course to make a simple test with you local or cloud storage:

    http://msdn.microsoft.com/en-us/WAZPlatformTrainingCourse_ExploringWindowsAzureStorageVS2010

    Hope it can help you.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    mercoledì 14 marzo 2012 09:11
    Moderatore
  • Hi,

    Can Azure Storage Explorer find your blob or table resources? Does your resources has been uploaded successfully?

    Following the Windows Azure Trainning course to make a simple test with you local or cloud storage:

    http://msdn.microsoft.com/en-us/WAZPlatformTrainingCourse_ExploringWindowsAzureStorageVS2010

    Hope it can help you.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    I'm not sure if Azure Storage Explorer will show the tables and blob containers containing analytics data as these are not returned when you list tables or blob containers. Furthermore he is trying to set up analytics and these are created once analytics is configured for a storage account.

    I would rather wait for the source code to see what's going on.

    mercoledì 14 marzo 2012 09:29
  • Hi,

    Right, I give that link because Dhwani says none of REST Management services API can excute successfully, so i suggest he use simple Blob storage API for testing.

    For Enabling and Configuring Storage Analytics, try to use following code snippets to see if it works:

                CloudStorageAccount account = CloudStorageAccount.Parse("<Connection String>");
                CloudBlobClient client = account.CreateCloudBlobClient();
                client.SetServiceProperties(new ServiceProperties() { Logging = new LoggingProperties() { Version = "1.0", LoggingOperations = LoggingOperations.Write, RetentionDays = 7 }, Metrics = new MetricsProperties() { Version = "1.0", RetentionDays = 7, MetricsLevel = MetricsLevel.ServiceAndApi } });
                ServiceProperties service = client.GetServiceProperties();


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    mercoledì 14 marzo 2012 10:24
    Moderatore
  • I am using a REST service client plugin in Mozilla firefox to execute the REST URI for rnabling storage analytics. Also I tried  to execute the REST URI using a java program. but both give me now 403  error - Forbidden for the authentication failure.

    The other thing is, i want to do all these things using java client libs of azure and not the .net or c#.  

    Also, as one of the folks asked me abt azure storage explorere -let me clear here that i am able to exploere my storage account using Azure storage explorer. that is not a problem. there is no confusion on that. 

    I am using following request properties in my REST service call in order to enable the storage analytic

    {"requestUrl":"http://<myaccount>.table.core.windows.net/?restype=service&comp=properties",

    "requestMethod":"PUT",

    "requestBody":"

    <?xml version=\"1.0\" encoding=\"utf-8\"?>\n<StorageServiceProperties>\n    <Logging>\n        <Version>1.0</Version>\n              <Delete>true</Delete>\n        <Read>false</Read>\n        <Write>true</Write>\n        <RetentionPolicy>\n            <Enabled>true</Enabled>\n            <Days>7</Days>\n        </RetentionPolicy>\n    </Logging>\n    <Metrics>\n        <Version>1.0</Version>\n        <Enabled>true</Enabled>\n        <IncludeAPIs>false</IncludeAPIs>\n        <RetentionPolicy>\n            <Enabled>true</Enabled>\n            <Days>7</Days>\n        </RetentionPolicy>\n    </Metrics>\n</StorageServiceProperties>","headers":["Authorization","SharedKey <myaccountname>:<myaccountkey>","x-ms-version","2011-08-18","x-ms-date","Sun, 25 Sep 2011 22:50:32 GMT","Range","","If-Unmodified-Since","","If-None-Match","","If-Match","","If-Modified-Since","","Date","","Content-Type","","Content-MD5","","Content-Length","","Content-Language","","Content-Encoding",""]}

    I tried to use fiddler for checking my http request -response details..did not get a root cause yet..I get 403 forbidden with the message of "Authentication failed..." while the same credentials do work for azure storage explorer.

    I am not sure if i am making any mistakes on calling the REST API..

    Please do ask for the details if you need to resolve my problem

    mercoledì 14 marzo 2012 11:03
  • There is an issue with your "Authorization" header and that's why you're getting 403 error. Please refer to http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx for how to create proper authorization header.

    Hope this helps.

    mercoledì 14 marzo 2012 12:22
  • I am exactly following the authorization refering the link you provided. Earlier i created the header using this only. Also tried the secondary key but no luck.

    are my azure account and storage account names can be different?

    giovedì 15 marzo 2012 12:35
  • Hi,

    Of course, Windows Azure account and storage names can be different.

    Do you ever following the sample headers of Storage Analytics service?

    PUT http://myaccount.table.core.windows.net/?restype=service&comp=properties HTTP/1.1
    x-ms-version: 2011-08-18
    x-ms-date: Tue, 27 Aug 2011 04:28:19 GMT
    Authorization: SharedKey
    myaccount:Z1lTLDwtq5o1UYQluucdsXk6/iB7YxEu0m6VofAEkUE=
    Host: myaccount.table.core.windows.net
    Hope it can help you.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    • Proposto come risposta RahulChugh martedì 8 aprile 2014 20:25
    venerdì 16 marzo 2012 02:34
    Moderatore
  • Sorry this does not help me. I user REST client for creating the REST request call. Is that causing something?

    Cause when I exactly followed the above thing, I get 400 code, which says that Authentication header is not in proper format.

    Does Authorization header value contain everything like:

    SharedKey<space>myaccountname:<keyvalue><space>Host:<hostname>

    or it is divided into multiple headers?

    Could you please clarify this?

    venerdì 16 marzo 2012 09:26
  • Hi - sorry this was not resolved.  If you look at the link to "authentication schemes", there's a section called "Constructing the signature string", which contains the information you are looking for.  The authorization header does not include the key value itself, since that would be dangerous.  Instead, the key is used to sign a canonicalized string.  Please go through the "constructing the signature string" section in the link Guarav shared, and see if that works.  Thanks!


    -Jeff

    lunedì 21 maggio 2012 06:26
  • Hi Dhavnika,

    Have you found the solution ? I am facing the same issue you explained above.

    Regards,

    KS


    -Kushal

    mercoledì 7 novembre 2012 23:15
  • Hi,

    You can use Azure Rest Api as follows (same for function you need)

    static void Main(string[] args)
     {
        //load this from your configuration file
        var payLoadSettings = new PayLoadSettings()
        {
            CloudServiceUrlFormat = "https://management.core.windows.net/{0}/services/hostedservices",
            SubscriptionId = "92533879-88c9-41fe-b24e-5251bcf49a8f",//fake subscription id - please provide yours
            Thumbprint = "3a f6 67 24 d8 d8 b3 71 b0 c4 d3 00 c2 04 0d 62 e5 30 76 1c", //fake cert thumbprint - please provide yours
            ServiceName = "newService1234567",//name your new service
            Label = "newService1234567", //give it a tracking label
            Description = "My new cloud service", //service description
            Location = "North Europe",//select centre
            AffinityGroup = "", //not created yet
            VersionId = "2011-10-01"//api version
        };
     
        var api = new RestAPIHelper(payLoadSettings);
     
        try
        {
            var requestId = api.CreateCloudService();
     
            Console.WriteLine("Cloud service has been created successfully :)" + Environment.NewLine + "Request id: " + requestId);
            Console.ReadLine();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            Console.ReadLine();
        }
    }

    Full source code available here:

    http://www.dotnet-geek.co.uk/index.php/using-windows-azure-service-management-rest-api-in-automated-tasks/



    none

    giovedì 20 giugno 2013 14:53