1
Vote

Get Table Service Properties

description

I was using your library to work with tables. I modified it to support the following API call:

https://<account-name>.table.core.windows.net/?restype=service&comp=properties

From: http://msdn.microsoft.com/en-us/library/azure/hh452238.aspx

In RESTHelper.cs I changed GetCanonicalizedResource to:
public string GetCanonicalizedResource(Uri address, string accountName)
        {
            StringBuilder str = new StringBuilder();
            StringBuilder builder = new StringBuilder("/");
            builder.Append(accountName);

            if (IsTableStorage && HttpUtility.ParseQueryString(address.Query).AllKeys.Contains("comp"))
            {
                builder.Append(address.PathAndQuery.Replace("restype=service&", String.Empty));
            }
            else
            {
                builder.Append(address.AbsolutePath);
            }

            str.Append(builder.ToString());
            NameValueCollection values2 = new NameValueCollection();
            if (!IsTableStorage)
            {
                NameValueCollection values = HttpUtility.ParseQueryString(address.Query);
                foreach (string str2 in values.Keys)
                {
                    ArrayList list = new ArrayList(values.GetValues(str2));
                    list.Sort();
                    StringBuilder builder2 = new StringBuilder();
                    foreach (object obj2 in list)
                    {
                        if (builder2.Length > 0)
                        {
                            builder2.Append(",");
                        }
                        builder2.Append(obj2.ToString());
                    }
                    values2.Add((str2 == null) ? str2 : str2.ToLowerInvariant(), builder2.ToString());
                }
            }
            ArrayList list2 = new ArrayList(values2.AllKeys);
            list2.Sort();
            foreach (string str3 in list2)
            {
                StringBuilder builder3 = new StringBuilder(string.Empty);
                builder3.Append(str3);
                builder3.Append(":");
                builder3.Append(values2[str3]);
                str.Append("\n");
                str.Append(builder3.ToString());
            }
            return str.ToString();
        }
This should account for the query params. Per Authentication for the Azure Storage Services under section "Constructing the Canonicalized Resource String" it states: The query string should include the question mark and the comp parameter (for example, ?comp=metadata). No other parameters should be included on the query string.

I'm not sure if you want to support this API call, but it should work now.

comments