HTTP API problem

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
qbawawa
Posts: 27
Joined: 30 Oct 2015 18:58

HTTP API problem

Post 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?
AlphaX2
Posts: 110
Joined: 25 Jul 2015 15:03

Re: HTTP API problem

Post 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.
User avatar
PoltoS
Posts: 7571
Joined: 26 Jan 2011 19:36

Re: HTTP API problem

Post 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
Post Reply