Page 1 of 1

HTTP API problem

Posted: 27 Nov 2015 23:25
by qbawawa
I'm trying to authenticate to use HTTP API. I try to send json request to url http://127.0.0.1:8083/ZAutomation/api/v1/login with json {"form":"true","login":"admin","password":"my_password","keepme":"false","default_ui":"1"} but it doesn't work - I don't get any response nor cookie. What can be wrong?

Re: HTTP API problem

Posted: 30 Nov 2015 02:04
by AlphaX2
Have you also set the Header? "Accept" and "Content-Type" should both be "application/json" and it needs a POST request! Also you may try it with the offical IP of your RasPi.

Re: HTTP API problem

Posted: 02 Dec 2015 01:22
by PoltoS
Please look on (How to execute API commands via HTTP API?):
http://razberry.z-wave.me/index.php?id=13

To use HTTP API you need to authenticate and then pass particular command to the server.

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"form": true, "login": "admin", "password": "admin", "keepme": false, "default_ui": 1}' 192.168.0.62:8083/ZAutomation/api/v1/login -c cookie.txt

curl 192.168.0.62:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_6-0-37/command/on -b cookie.txt

or just

curl -v -u admin:admin 192.168.0.62:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_6-0-37/command/on