access_via_api
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
access_via_api [2019/03/12 14:45] – akuzmuk | access_via_api [2020/04/07 10:05] – [Getting graph data] emozolyak | ||
---|---|---|---|
Line 624: | Line 624: | ||
To obtain entries from the register register, you must perform follwing GET request on a URL http:// | To obtain entries from the register register, you must perform follwing GET request on a URL http:// | ||
- | In the request headers, it is necessary to pass the API key, the boundaries of the time interval of interest, and a list of register identifiers. X-WH-START and X-WH-END are transmitted in UnixTime format. The register ID is passed by a comma-separated list in the X-WH-REG-IDS | + | In the request headers, it is necessary to pass the API key, the boundaries of the time interval of interest, and a list of register identifiers. X-WH-START and X-WH-END are transmitted in UnixTime format. The register ID is passed by a comma-separated list in the X-WH-REGISTERS |
X-WH-APIKEY: | X-WH-APIKEY: | ||
X-WH-START: 1422595501 | X-WH-START: 1422595501 | ||
X-WH-END: 1422599101 | X-WH-END: 1422599101 | ||
- | X-WH-REG-IDS: 8,10 | + | X-WH-REGISTERS: 8,10 |
| | ||
Also, in the headers, you must specify the desired data exchange format. Currently, only the JSONformat is supported. | Also, in the headers, you must specify the desired data exchange format. Currently, only the JSONformat is supported. | ||
Line 648: | Line 648: | ||
X-WH-START: 1422595501 | X-WH-START: 1422595501 | ||
X-WH-END: 1422599101 | X-WH-END: 1422599101 | ||
- | X-WH-REG-IDS: 8,10 | + | X-WH-REGISTERS: 8,10 |
Reply example: | Reply example: | ||
Line 883: | Line 883: | ||
X-WH-APIKEY: | X-WH-APIKEY: | ||
- | 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. | + | 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-CONNECTIONS |
Example: | Example: | ||
- | X-WH-CONNS: 1,2 | + | X-WH-CONNECTIONS: 1,2 |
| | ||
In this example, register values for the ID=1 and ID=2 will be returned. | In this example, register values for the ID=1 and ID=2 will be returned. | ||
Line 906: | Line 906: | ||
Accept-Encoding: | Accept-Encoding: | ||
X-WH-APIKEY: | X-WH-APIKEY: | ||
- | X-WH-CONNS: 1,2 | + | X-WH-CONNECTIONS: 1,2 |
| | ||
Example of the response: | Example of the response: | ||
Line 1296: | Line 1296: | ||
|title |string |Image name| | |title |string |Image name| | ||
- | ===== Getting | + | ===== Getting |
- | To get data from graph log, it is necessary | + | There is an option |
- | Also, instead of specifying | + | To obtain entries from the meters, you must perform follwing GET request on a URL |
+ | http://192.168.1.1/ | ||
- | X-WH-REGS: 23,12,4 | + | In the request headers, |
- | + | ||
- | In the request headers, | + | |
X-WH-APIKEY: | X-WH-APIKEY: | ||
- | X-WH-START: | + | X-WH-START: |
- | X-WH-END: | + | X-WH-END: |
- | X-WH-SLICES: 300 | + | X-WH-REGISTERS: 8,10 ?? check this |
- | + | ||
- | X-WH-SLICES is the number of values. The time interval X-WH-START-X-WH-END will be divided into X-WH-SLICES of equal intervals and the system will take the most detailed values for each of them. | + | Also, in the headers, you must specify the desired data exchange format. Currently, only the JSONformat |
- | X-WH-SLICES should be chosen based on the necessary detail of the graph. So, if you need to build a graph 800 pixels wide, then it makes no sense to choose more than 800 values from the log. And sometimes there will be enough 200-400 values depending on the width of the line on the graph. | + | |
- | + | ||
- | To speed up the operation, the system can store the averaged values of the registers for different intervals (1 minute, 2 minutes, 5 minutes, 15 minutes, 1 hour). In the configuration of each register, you can specify the required detail of the stored data. Depending on the selected time interval and the number of values, the system will attempt to take data from the most appropriate table of averaged values. or from the register register (if it is included for the specified register) | + | |
- | + | ||
- | Also, in the headers, you must specify the desired data exchange format. Currently, only the JSON format | + | |
Accept: application/ | Accept: application/ | ||
Content-Type: | Content-Type: | ||
- | | ||
- | Example of getting data for graph #1: | ||
- | | + | Example of querying records from the register log: |
- | ***Method:** GET | + | |
- | *Headers: | + | |
+ | ***Method**: GET | ||
+ | *Header: | ||
Accept: application/ | Accept: application/ | ||
Line 1331: | Line 1325: | ||
Accept-Encoding: | Accept-Encoding: | ||
X-WH-APIKEY: | X-WH-APIKEY: | ||
- | X-WH-START: | + | X-WH-START: |
- | X-WH-END: | + | X-WH-END: |
- | X-WH-SLICES: 20 | + | X-WH-REGISTERS: 8,10 |
+ | |||
+ | Reply example: | ||
- | Response example: | ||
< | < | ||
- | [ | + | { |
- | | + | "1422598266": |
- | | + | |
- | "10": | + | |
- | "16": "NaN;NaN;NaN", | + | "v": "6", |
- | "x": | + | "s": |
- | }, | + | }, |
- | { | + | { |
- | "8": | + | "r": |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "NaN;NaN;NaN", | + | "s": "" |
- | | + | |
- | | + | |
- | | + | |
- | " | + | |
- | "10": "NaN;NaN;NaN", | + | |
- | "16": "NaN;NaN;NaN", | + | "v": "11", |
- | "x": | + | "s": "-1" |
- | }, | + | }, |
- | { | + | |
- | " | + | |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "NaN;NaN;NaN", | + | "s": |
- | "x": | + | } |
- | }, | + | ], |
- | | + | |
- | " | + | |
- | "10": "NaN;NaN;NaN", | + | "r": |
- | "16": "0.000000; | + | "v": "16", |
- | "x": | + | "s": "-1" |
- | }, | + | }, |
- | | + | |
- | "8": "0.000000; | + | |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "0.000000; | + | "s": |
- | | + | } |
- | | + | ], |
- | { | + | |
- | "8": | + | |
- | "10": "NaN;NaN;NaN", | + | |
- | "16": "0.000000; | + | "v": " |
- | | + | "s": "-1" |
- | | + | }, |
- | { | + | |
- | "8": | + | |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "0.000000; | + | "s": |
- | | + | } |
- | | + | |
- | { | + | "1422598285": |
- | "8": | + | { |
- | "10": "NaN;NaN;NaN", | + | |
- | "16": "0.000000; | + | "v": "5", |
- | | + | "s": "-1" |
- | | + | }, |
- | { | + | { |
- | "8": | + | "r": |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "0.000000; | + | "s": "" |
- | | + | |
- | | + | |
- | { | + | |
- | "8": | + | |
- | "10": "NaN;NaN;NaN", | + | "r": |
- | "16": "0.000000; | + | "v": "10", |
- | | + | "s": "-1" |
- | | + | }, |
- | | + | { |
- | " | + | "r": |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "0.000000; | + | "s": "" |
- | "x": | + | |
- | | + | |
- | { | + | |
- | "8": | + | |
- | "10": "NaN;NaN;NaN", | + | "r": |
- | "16": "0.000000; | + | "v": "15", |
- | | + | "s": "-1" |
- | | + | }, |
- | { | + | { |
- | "8": | + | "r": |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "0.000000; | + | "s": "" |
- | | + | |
- | | + | |
- | { | + | |
- | "8": | + | |
- | "10": "NaN;NaN;NaN", | + | "r": 8, |
- | "16": "0.000000; | + | "v": " |
- | | + | "s": "-1" |
- | | + | }, |
- | { | + | |
- | "8": | + | |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "0.000000; | + | "s": |
- | | + | } |
- | | + | |
- | { | + | |
- | "8": | + | |
- | "10": "NaN;NaN;NaN", | + | "r": |
- | "16": "0.000000; | + | "v": "5", |
- | | + | "s": "-1" |
- | | + | }, |
- | { | + | { |
- | "8": | + | "r": |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "0.000000; | + | "s": "" |
- | | + | |
- | | + | |
- | | + | |
- | " | + | |
- | "10": "NaN;NaN;NaN", | + | "r": |
- | "16": "0.000000; | + | "v": "10", |
- | "x": | + | "s": "-1" |
- | }, | + | }, |
- | | + | { |
- | " | + | "r": |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "0.000000; | + | "s": "" |
- | "x": | + | |
- | }, | + | |
- | | + | |
- | " | + | |
- | "10": "NaN;NaN;NaN", | + | "r": |
- | "16": "0.000000; | + | "v": "15", |
- | "x": | + | "s": "-1" |
- | }, | + | }, |
- | | + | { |
- | " | + | "r": |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "0.000000; | + | "s": "" |
- | "x": | + | |
- | }, | + | |
- | | + | |
- | " | + | |
- | "10": "NaN;NaN;NaN", | + | |
- | "16": "NaN;NaN;NaN", | + | "v": " |
- | "x": | + | "s": "-1" |
- | }, | + | }, |
- | | + | |
- | " | + | |
- | "10": "NaN;NaN;NaN", | + | "v": "", |
- | "16": "NaN;NaN;NaN", | + | "s": |
- | "x": | + | } |
- | } | + | ], |
+ | | ||
+ | | ||
+ | | ||
+ | "v": "5", | ||
+ | "s": "-1" | ||
+ | }, | ||
+ | | ||
+ | | ||
+ | "v": "", | ||
+ | "s": | ||
+ | } | ||
+ | ], | ||
+ | | ||
+ | | ||
+ | | ||
+ | "v": "10", | ||
+ | "s": "-1" | ||
+ | }, | ||
+ | | ||
+ | | ||
+ | "v": "", | ||
+ | "s": | ||
+ | } | ||
+ | ], | ||
+ | | ||
+ | | ||
+ | | ||
+ | "v": "15", | ||
+ | "s": "-1" | ||
+ | }, | ||
+ | | ||
+ | | ||
+ | "v": "", | ||
+ | "s": | ||
+ | } | ||
+ | ], | ||
+ | | ||
+ | | ||
+ | | ||
+ | "v": "0", | ||
+ | "s": "-1" | ||
+ | }, | ||
+ | | ||
+ | | ||
+ | "v": "", | ||
+ | "s": | ||
+ | } | ||
+ | ], | ||
+ | | ||
+ | | ||
+ | | ||
+ | "v": "5", | ||
+ | "s": "-1" | ||
+ | }, | ||
+ | | ||
+ | | ||
+ | "v": "", | ||
+ | "s": | ||
+ | } | ||
+ | ], | ||
+ | и т.д. | ||
] | ] | ||
</ | </ | ||
- | The structure of the returned data is as follows. An array of objects | + | Returns |
- | Also in this object there are attributes with values for each register. The attribute name is the register ID. The attribute value is a string where the minimum, average and maximum | + | Each object has three properties: r, v, s. |
+ | |||
+ | ^r|is the register ID. For example, 10 | | ||
+ | ^v|is the value of the register | ||
+ | ^s|is the state of the register | ||
+ | | -1|Unknown | | ||
+ | | 0|Disabled | | ||
+ | | 1|Normal | | ||
+ | | 2|Warning | | ||
+ | | 3|Alert | | ||
+ | | '' | ||
===== Event list ===== | ===== Event list ===== |
access_via_api.txt · Last modified: 2023/03/02 10:53 by emozolyak