locked
how to encode azure table storage REST query RRS feed

  • Question

  • anyone know how to encode REST query?

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

    seems not all charactor are needed to be encoded

    /myaccount/Customers()?$filter=(Rating%20ge%203)%20and%20(Rating%20le%206)$select=PartitionKey,RowKey,Address,CustomerSince

     

    I try to use HttpUtility.UrlEncode
    string path = "(abc ge '123') and (def lt 20)";
    Console.WriteLine(HttpUtility.UrlEncode(path));
    the out come doesn`t seems right

    (abc+ge+%27123%27)+and+(def+lt+20)


    anyone has any idea what part need to be encnde.. and what kind of encoding does azure table storage use?

    Thursday, December 1, 2011 7:58 AM

Answers

  • Hi,

    Generally you would want to URL encode your querystring parameters (like $filter & $select). Since the attribute names can't contain any special characters, I think you can skip "$select" querystring parameter. $filter should be URL encoded. We also use HttpUtility.UrlEncode to encode the "$filter" querystring parameter.

    What's the problem are you seeing with the way you have URL encoded the path variable currently?

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

     

     

    Thursday, December 1, 2011 9:33 AM