API - Getting current registers values
To get a list of all registers, you must perform a GET request on the URL like this: http://192.168.1.1/api/registers.
In the headers, it is necessary to pass API key. For example:
X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
In the request headers, you must pass the connection IDs (IDs). Register values will be returned only from those connections whose ID are specified in the X-WH-CONNS header. ID should be separated by comma, without spaces. This allows you to request not all registers, but only a part.
Example:
X-WH-CONNS: 1,2
In this example, register values for the ID=1 and ID=2 will be returned.
Also, in the headers, you must specify the desired data exchange format. Currently, only the JSON format is supported.
Accept: application/json Content-Type: application/json
Example of querying current register values:
URL: http://192.168.1.1/api/register-values
Method: GET
Headers:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7 X-WH-CONNS: 1,2
Example of the response:
{ "1": { "r": "1", "v": "-1", "s": "i" }, "2": { "r": "2", "v": "-1", "s": "i" }, "3": { "r": "3", "v": "-1", "s": "i" }, "4": { "r": "4", "v": "1422600498", "s": "u" }, "5": { "r": "5", "v": "1422600498", "s": "u" }, "6": { "r": "6", "v": "-1", "s": "i" }, "7": { "r": "7", "v": "-1", "s": "i" }, "8": { "r": "8", "v": "18", "s": "u" }, "9": { "r": "9", "v": "0", "s": "u" } }
The format of the returned data is as follows:
Returns the object, where the property names are register IDs. And the properties themselves are yet another objects.
Each object has three properties: r, v, s.
'r' is the register ID. For example, 10
'v' is the value of the register at the current time or '-1' if the value does not work.
's' is the state of the register that matched it at the specified time. Unknown = u, Disabled = d, Normal = n, Warning = w, Alert = a, Incorrect = i.