User Tools

Site Tools


access_via_api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
access_via_api [2019/06/07 14:27] – [Getting current registers values] akuzmukaccess_via_api [2020/04/07 10:08] – [Getting register log] emozolyak
Line 624: Line 624:
 To obtain entries from the register register, you must perform follwing GET request on a URL http://192.168.1.1/api/register-log. To obtain entries from the register register, you must perform follwing GET request on a URL http://192.168.1.1/api/register-log.
  
-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 header. For example:+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 header. For example:
  
   X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7   X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
   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 874: Line 874:
 | 3|Alert | | 3|Alert |
 | '' (an empty string)|there is no register value. | | '' (an empty string)|there is no register value. |
 +
 +===== Getting meters log =====
 +
 +To obtain entries from the register register, you must perform follwing GET request on a URL http://192.168.1.1/api/meters-log.
 +
 +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 header. For example:
 +
 +  X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
 +  X-WH-START: 1422595501
 +  X-WH-END: 1422599101
 +  X-WH-REGISTERS: 8,10 check this ???
 +  
 +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 records from the meters log:
 +
 +  ***URL**: http://192.168.1.1/api/register-log
 +  ***Method**: GET
 +  *Header:
 +
 +  Accept: application/json
 +  Content-Type: application/json
 +  Accept-Encoding: gzip, deflate, sdch
 +  X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
 +  X-WH-START: 1422595501
 +  X-WH-END: 1422599101
 +  X-WH-REGISTERS: 8,10
 +
 +Reply example:
 +
 +<code>
 +{
 +  "1422598266": [
 +    {
 +      "r": 8,
 +      "v": "6",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598271": [
 +    {
 +      "r": 8,
 +      "v": "11",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598276": [
 +    {
 +      "r": 8,
 +      "v": "16",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598280": [
 +    {
 +      "r": 8,
 +      "v": "0",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598285": [
 +    {
 +      "r": 8,
 +      "v": "5",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598290": [
 +    {
 +      "r": 8,
 +      "v": "10",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598295": [
 +    {
 +      "r": 8,
 +      "v": "15",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598300": [
 +    {
 +      "r": 8,
 +      "v": "0",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598305": [
 +    {
 +      "r": 8,
 +      "v": "5",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598310": [
 +    {
 +      "r": 8,
 +      "v": "10",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598315": [
 +    {
 +      "r": 8,
 +      "v": "15",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598320": [
 +    {
 +      "r": 8,
 +      "v": "0",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598325": [
 +    {
 +      "r": 8,
 +      "v": "5",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598330": [
 +    {
 +      "r": 8,
 +      "v": "10",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598335": [
 +    {
 +      "r": 8,
 +      "v": "15",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598340": [
 +    {
 +      "r": 8,
 +      "v": "0",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  "1422598345": [
 +    {
 +      "r": 8,
 +      "v": "5",
 +      "s": "-1"
 +    },
 +    {
 +      "r": 10,
 +      "v": "",
 +      "s": ""
 +    }
 +  ],
 +  и т.д.
 +]
 +</code>
 +
 +Returns the array, where the index is time in UnixTime format. Elements of the array have another array of 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 specified time point or an empty string if there is no data for this register at this time. | 
 +^s|is the state of the register that matched it at the specified time: |  
 +| -1|Unknown |
 +| 0|Disabled | 
 +| 1|Normal |
 +| 2|Warning |
 +| 3|Alert |
 +| '' (an empty string)|there is no register value. |
 +
  
 ===== Getting current registers values ===== ===== Getting current registers values =====
Line 1300: Line 1556:
 To get data from graph log, it is necessary to run following GET-query for URL http://192.168.1.1/api/graph-data/2. Here 2 - is the ID of the graph of interest. To get data from graph log, it is necessary to run following GET-query for URL http://192.168.1.1/api/graph-data/2. Here 2 - is the ID of the graph of interest.
  
-Also, instead of specifying the graph ID, you can send the X-WH-REGS header. It specifies, through the comma, the ID of the registers for which data is to be extracted. Example:+Also, instead of specifying the graph ID, you can send the X-WH-REGISTERS header. It specifies, through the comma, the ID of the registers for which data is to be extracted. Example:
  
-  X-WH-REGS: 23,12,4+  X-WH-REGISTERS: 23,12,4
  
 In the request headers, you must pass the API key, the boundaries of the time interval of interest (X-WH-START, X-WH-END) and the number of values ​​(X-WH-SLICES). X-WH-START and X-WH-END are transmitted in UnixTime format. For example: In the request headers, you must pass the API key, the boundaries of the time interval of interest (X-WH-START, X-WH-END) and the number of values ​​(X-WH-SLICES). X-WH-START and X-WH-END are transmitted in UnixTime format. For example:
access_via_api.txt · Last modified: 2023/03/02 10:53 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki