Page 1 of 1

Access server-side API

Posted: 07 Jun 2016 20:37
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.

Re: Access server-side API

Posted: 16 Jun 2016 12:59
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.

Re: Access server-side API

Posted: 31 Jul 2016 01:18
by PoltoS
Once logged in as admin, you can use ip:8083/JS/Run/zway.devices[3]..... URLs to access low level API

Re: Access server-side API

Posted: 02 Aug 2016 20:19
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()

Re: Access server-side API

Posted: 04 Aug 2016 21:08
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