POST for Azure Mobile/Web App (working from Arduino)

99封情书 提交于 2019-12-13 04:29:01

问题


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.



来源:https://stackoverflow.com/questions/36836566/post-for-azure-mobile-web-app-working-from-arduino

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!