Getting register log

Материал из WebHMI Wiki
Перейти к: навигация, поиск
Эта страница — перевод страницы API - Получение лога регистров. Перевод выполнен на 100%.

Другие языки:
English • ‎русский
Другие языки:
English • ‎русский

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:

X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
X-WH-START: 1422595501
X-WH-END: 1422599101
X-WH-REG-IDS: 8,10

Также в заголовках необходимо указать желаемый формат обмена данными. Сейчас поддерживатеся работа только с форматом JSON. Also, in the headers, you must specify the desired data exchange format. Currently, only the JSONformat is supported.

Accept: application/json
Content-Type: application/json


Example of querying records from the register 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-REG-IDS: 8,10

Reply example:

{
  "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": ""
    }
  ],
  и т.д.
]


Returns the array, where the index is time in UnixTime format. Elements of the array have another array of objects. The
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. Unknown = -1, Disabled = 0, Normal = 1, Warning = 2, Alert = 3 or an empty string if there is no register value.