Authentication Through REST API

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
saqib6161
Posts: 12
Joined: 24 Feb 2022 10:59

Authentication Through REST API

Post by saqib6161 »

Hi, I am new here anyone expert here??? I want to use z-wave.me as a HUB on their given hardware, I want to make our own app to control all devices such as adding device and managing it. I just need to confirm how to register or login through API which we doing same at the start configuration with z-wave.me interface. So is it possible to do through API. and also how to make a API request to discover nearby devices and add them to hub. if anyone is know all this questions please answer me.
Thanks in advance
the wife
Posts: 23
Joined: 27 Oct 2015 21:02

Re: Authentication Through REST API

Post by the wife »

If you search for the following string on the forum you will find lots of posts showing how to authenticate via various methods (eg python, curl)

/ZAutomation/api/v1/login

I wrote my own Android app to control my system but I use Firefox's RESTClient extension to test commands. An authentication request would look like this in RESTClient:

POST
http://192.168.1.12:8083/ZAutomation/api/v1/login

with the body set to
{"form":true,"login":"admin","password":"mypasswordforuseradmin","keepme":false,"default_ui":1}

And the response would be something like:

{"data":{"id":1,"role":1,"login":"admin","name":"Administrator","lang":"en","color":"#dddddd","dashboard":[],"interval":2000,"rooms":[0],"expert_view":true,"hide_all_device_events":false,"hide_system_events":false,"hide_single_device_events":[],"email":"","sid":"6fabfc48-9295-b869-22a7-218cf57bba9d"},"code":200,"message":"200 OK","error":null}

the returned sid is then required for future requests, eg for devices
GET
http://192.168.1.12:8083/ZAutomation/api/v1/devices
with body
{"sid":"6fabfc48-9295-b869-22a7-218cf57bba9d"}

My system is quite old - I'm running firmware v2.2.3. Not sure which zway server software version. So things may have changed a bit.
I have a load of python scripts on github that may be of help
https://github.com/babsk/ZWay-API-Python-Access
start with login.py

I added quite a few custom commands to the zway server, so the other scripts may not make a lot of sense
Hope that helps
lanbrown
Posts: 333
Joined: 01 Jun 2021 08:06

Re: Authentication Through REST API

Post by lanbrown »

You might want to check the documentation regarding the API:
https://zwayhomeautomation.docs.apiary.io/#
saqib6161
Posts: 12
Joined: 24 Feb 2022 10:59

Re: Authentication Through REST API

Post by saqib6161 »

I saw the https://zwayhomeautomation.docs.apiary.io/# this link and http://192.168.1.12:8083/ZAutomation/api/v1/login but I found it is login one !. I want to make full start setup where we need a registration at first time on z-wave.me interface
lanbrown
Posts: 333
Joined: 01 Jun 2021 08:06

Re: Authentication Through REST API

Post by lanbrown »

If you go to "My Settings" and at the bottom you can see an API token that can be used. I would suggest that part of your process has a dedicated account created that you use to communicate with Z-Way. This way the token won't change and is not the admin account. Best security practice here.
jacynthe70
Posts: 1
Joined: 29 Aug 2023 11:22

Re: Authentication Through REST API

Post by jacynthe70 »

obtain an auth token, discover devices, include new nodes, then use the zwaveapi methods to add, configure and control devices programmatically. The documentation has code samples to help get started. Here are some pointers on how to get started:geometry dash
  • To login, send a POST request to /auth with your username and password. This will return an access token to use for subsequent requests.
  • To discover nearby devices, use the /zwaveapi/get_nodes API method. This will return an array of unpaired devices in range.
  • To add a device, call /zwaveapi/include_node with the nodeid of the device you want to include.
  • Once added, you can call /zwaveapi/get_nodes again to see the updated list of paired devices.
  • To control devices, use methods like /zwaveapi/set_node_value to set values and parameters on a node.
  • Refer to the API documentation for the full list of available methods for node management, groups, scenes, etc.
  • Make sure your API user has sufficient privileges to call these methods.
Stay close to anything that makes you glad you are alive. geometry dash
ebarinu
Posts: 1
Joined: 20 Feb 2023 23:17

Re: Authentication Through REST API

Post by ebarinu »

Tokens are usually used for authentication over the REST API. The server creates a token that the app may use for next requests when a user checks in. For information on certain endpoints and authentication techniques, see the documentation at z-wave.me.
Post Reply