Remote Control with MIT AppInvertor2

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
hagai303
Posts: 2
Joined: 08 Feb 2016 18:50

Remote Control with MIT AppInvertor2

Post by hagai303 »

Hello,

I am trying to connect to the Z-Way Virtual Device API from MIT AppInvertor2

I am using the post method to login with the url: http://Razberry_IP:8083/ZAutomation/api/v1/login

but keep getting 500 Error "unexpected token o"

can someone please refer me to some place where I can find answers.

thanks.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Remote Control with MIT AppInvertor2

Post by pz1 »

http://razberry.z-wave.me Support/Manuals/Developers manual
Since 29-12-2016 I am no longer a moderator for this forum
hagai303
Posts: 2
Joined: 08 Feb 2016 18:50

Re: Remote Control with MIT AppInvertor2

Post by hagai303 »

I already looked at all the documentation files but couldn't find the answer..

there is no place that say how to use Virtual Device API or Z-Way API via android app.

please can you please refer me to more detailed document
the wife
Posts: 23
Joined: 27 Oct 2015 21:02

Re: Remote Control with MIT AppInvertor2

Post by the wife »

I have the beginnings of an Android app which successfully logs in and retrieves devices etc. I have only done this through my local network so far. I used the Android SDK rather than AppInventor but hopefully what follows will help you.

I had some issues initially because I misinterpreted the documentation. I resolved my problems by tracing the HTTP requests made from the smarthome browser app. I used http://www.telerik.com/fiddler to do this.

I then used a REST Client (http://restforchrome.blogspot.co.uk/) in a browser to mimic and edit the requests I had seen. This was to get a better understanding of what needs to go in the header and body of the HTTP requests.

For example, the body of a login POST request looks like this:
{"form":true,"login":"admin","password":"admin","keepme":false,"default_ui":1}

I just tried this from the REST client whilst writing these notes and got your exact error 'unexpected token o' and in this case it was due to the REST client defaulting the header content-type to '...urlencoded'. Changing the content-type to 'application/json' fixed this.

Playing around with these tools really helped me get a grasp of what my Android app needed to send and when I went back to the documentation it made a lot more sense.
Karsten
Posts: 34
Joined: 09 May 2016 20:06

Re: Remote Control with MIT AppInvertor2

Post by Karsten »

Hey,
trying to start with a little Appinventor app for zway too.
Can anybody enventually post an .aia file with an example, esp. with regard to login by using appinventor web component?
Would be very helpful...
Big thanks in advance...
Cheers
K
Post Reply