POST for Azure Mobile/Web App (working from Arduin

2019-09-02 02:20发布

问题:

I want to find samples of how to work with Mobile/Web App by sending POST.
Previously in Mobile Services it was possible to send POST like this:

POST /tables/table_name HTTP/1.1
Host: http://arduinounoserver.azure-mobile.net/
X-ZUMO-APPLICATION: YaRWxxxxzKGRxxxxLPiNxxxxXYOvxxxx
{"value": 234}

But now authentication was absolutely changed.
How to do it now and is it possible to find somewhere POST samples?

Have found only Table Service REST API but it's still not clear for me

回答1:

you can still use next URL notation to access tables:

https://yoursite/tables/tablename

but, you can get an error:

{"error":"An invalid API version was specified in the request, this request needs to specify a ZUMO-API-VERSION of 2.0.0."}

so with Web App Easy Table you should use next ZUMO-header, for example

POST https://vyutest.azurewebsites.net/Tables/Test HTTP/1.1

Accept: application/json 
Content-Type: application/json 
Content-Length: 49 
ZUMO-API-VERSION: 2.0.0 
Host: vyutest.azurewebsites.net

{"text":"Complete the tutorial","complete":false}

It works.