I am testing the REST API services for Azure Table Storage, I can get data without problems from the table, but I can't seem to be able to update records from javascript. Using Fiddler for the same operation instead works. The url is
https://"myaccount".table.core.windows.net/p73cca0789a574fd4a5b98012a8bb56bf(PartitionKey=%27Settings%27,RowKey=%27GeneralSettings_UICulture_1%27)?sv=2014-02-14&tn=p73cca0789a574fd4a5b98012a8bb56bf&spk=Settings&epk=Settings&sig=ue%2BdY4qa0Kk8MJ083jzuAqn7miGmIBV2C4DK6x7LL%2Bs%3D&se=2014-07-10T12%3A02%3A12Z&sp=raud
in Fiddler I set PUT as httpMethod and this as request body:
{
Value: 'en',
Version: 1,
SettingName: 'GeneralSettings'
}
and it works OK, if I check the Table on Azure the value is updated correctly From my web app instead, I use amplifyjs to make the ajax call, defining the method like this:
amplify.request.define('manageSetting', 'ajax', {
url: url,
dataType: 'json',
beforeSend: function( xhr ) {
xhr.setRequestHeader("Content-Type", "application/json");
},
decoder: "defaultBehavior",
type: httpMethod
});
And I get a 400 Bad Request error, with the message: 'One of the request inputs is not valid' In Firebug I can see these are my request headers:
Accept application/json, text/javascript, */*; q=0.01
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Content-Length 46
Content-Type application/json; charset=UTF-8
DNT 1
Host "myaccount".table.core.windows.net
Origin https://localhost:444
Referer https://localhost:444/MyWebApp/projects/dde1b522-0c7d-40f1-8e08-5c39a1ce91ef
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0
x-ms-date Wed, 09 Jul 2014 14:10:24 GMT
x-ms-version 2014-02-14
The 'Put' tab of the request in Firebug states:
Value=en&Version=1&SettingName=GeneralSettings
Am I missing something? Thanx