Page 1 of 1

Authentication Through REST API

Posted: 24 Feb 2022 11:04
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

Re: Authentication Through REST API

Posted: 24 Feb 2022 14:27
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

Re: Authentication Through REST API

Posted: 25 Feb 2022 04:11
by lanbrown
You might want to check the documentation regarding the API:
https://zwayhomeautomation.docs.apiary.io/#

Re: Authentication Through REST API

Posted: 25 Feb 2022 10:46
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

Re: Authentication Through REST API

Posted: 26 Feb 2022 08:32
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.

Re: Authentication Through REST API

Posted: 28 Feb 2022 01:28
by PoltoS

Re: Authentication Through REST API

Posted: 29 Aug 2023 11:29
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.

Re: Authentication Through REST API

Posted: 01 Apr 2024 16:04
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.