Access server-side API

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
djcohn
Posts: 2
Joined: 07 Jun 2016 20:29

Access server-side API

Post by djcohn »

The documentation for Z-Way development, on page 11, refers to accessing the JS API on the server side:

"3. zway.devices[3].*: Server Side access using the JS and the public zway object"


How can I access the JS API server-side? Is there a JS file that I can include that defines the zway object and gives me access to the API? I am writing my own automation code and web server using nodejs and would much rather import a JS API than write code to make HTTP calls to 127.0.0.1:8083.
AlphaX2
Posts: 110
Joined: 25 Jul 2015 15:03

Re: Access server-side API

Post by AlphaX2 »

I just know that this works if you are creating a JS device on the UI, so ZWay server itself is using it. But I don't know how to use it for your project?! But it could also helpful for me, so every idea is welcome.
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Access server-side API

Post by PoltoS »

Once logged in as admin, you can use ip:8083/JS/Run/zway.devices[3]..... URLs to access low level API
djcohn
Posts: 2
Joined: 07 Jun 2016 20:29

Re: Access server-side API

Post by djcohn »

I'd like to actually load the JS API so that I can interact with it as an object, instead of making HTTP requests to a URL.

Instead of my code looking like this:

Code: Select all

$.get('localhost:8083/JS/Run/zway.devices[3].instances[0].turnOn())
I'd like it to look like this:

Code: Select all

zway.devices[3].instances[0].turnOn()
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Access server-side API

Post by PoltoS »

You will need to make a big API for this... Not so easy... May be it is worth to make such a wrapper. We will think of it
Post Reply