Question

Aram Koukia on Sat, 05 Mar 2016 20:58:08


I'm trying out the Azure Mobile App API and getting an error on making Patch calls.

GET and POST and DELETE works fine.

Here is what my url looks like:

PATCH http://mymobileappapi.azurewebsites.net/tables/Skill/c89027fa-edce-4d36-b42a-ecb0920ebab6

body:

{
  "name": "Leadership SDFF"
}

I have these as headers too (as I said other http verbs work.)

ZUMO-API-VERSION 2.0.0
Content-Type Application/Json

And I get 500 error back with this in the body:

{
  "error": "An item to update was not provided"
}

The same id works when I do a GET using that id...

And when I make the same call using same body with PUT i get a 404 Not found without any content in the response body.

Any ideas?


Aram Koukia | Blog: koukia.ca | Twitter: @aramkoukia




Sponsored



Replies

Gary Liu - MSFT on Mon, 07 Mar 2016 06:22:30


Do you have any custom code in the update function in the table script? As I have a quick test on the mobile app easy tables api script, the PATCH method worked fine on my side and I successfully to update the data.

Additionally, you can change the application logging level to "verbose" to get more information of logs in output section when you edit scripts via easy tables on VSO.

Any further concern, please feel free to let me know.

Adrian Hall (MSFT) on Mon, 07 Mar 2016 19:04:00


Do you get the same problem when you PUT /tables/Skill with a body that includes both id and name?

Aram Koukia on Mon, 07 Mar 2016 19:23:42


Do you have any custom code in the update function in the table script? As I have a quick test on the mobile app easy tables api script, the PATCH method worked fine on my side and I successfully to update the data.

Additionally, you can change the application logging level to "verbose" to get more information of logs in output section when you edit scripts via easy tables on VSO.

Any further concern, please feel free to let me know.

No I dont have any custom code.

I will try the verbose log and see if there is anything that can help and let you know.

Aram Koukia on Mon, 07 Mar 2016 19:24:37


Do you get the same problem when you PUT /tables/Skill with a body that includes both id and name?

PUT with including the Id and Name returns 404..

I created an issue here: 

https://github.com/Azure/azure-mobile-apps-node/issues/368

Aram Koukia on Mon, 07 Mar 2016 20:30:35


It turns out our implementation requires the content-type header value to be lower case, i.e. application/json works, whereas Application/Json doesn't. I've updated this issue to be the placeholder for the fix. As a workaround in the meantime, make the value for the content-type header lower case.

https://github.com/Azure/azure-mobile-apps-node/blob/master/src/express/middleware/parseItem.js#L27

should use req.get instead of req.headers. Keep in mind that values can also include encoding, e.g. application/json; charset=utf-8

Here is link to the issue:

https://github.com/Azure/azure-mobile-apps-node/issues/368