Skip to main content

HTTP APIs

The device offers a range of functions in the form of HTTP APIs, that can be used by making HTTP requests (GET or POST) from external systems connected to the same network.

This allows the device's data to be read and the digital outputs and watchdogs to be controlled in a programmatic fashion, e.g. by means of an AI agent or a monitoring system.

Access Control

To prevent unauthorized access to the data stored on the device, there is an access control layer in place.

If on the security configuration page

an API-Key is required to be included in the API request by including a HTTP Header of the form

Authorization: API-Key KEY

where KEY is to be replaced by the actual API-Key.

info

An API-Key can be generated and viewed/copied on the Security configuration page under API-Key.

Once generated, the key will persist until regenerated, deleted, or the device configuration gets reset.

warning

For the control API an API-Key is required in any case.

Historical peripheral data in CSV

This API provides two endpoints, returning historical peripheral data in CSV format.

PurposeMethodURL
Sensor dataGEThttp://HOST/tpl/document.cgi?tpl=/tpl/general/default/history_csv.tpl
Changes (Inputs/Outputs/Watchdogs)GEThttp://HOST/tpl/document.cgi?tpl=/tpl/general/default/changes_csv.tpl
info

HOST is to be replaced by the host belonging to the device.

Both endpoints accept the following query parameters:

Query ParameterDescription
limit_typeIf set to days, the limit parameter specifies the number of days; otherwise, it specifies the number of entries.
limitLimits the returned entries. See limit_type.
stepIf specified, the timerange function is used to aggregate entries into intervals of this size.
formatTimestamp format. See the strftime template function function.
localIf not equal to 0, local time is used.

Evaluate stored templates

The template feature allows you to store custom templates on the device for later evaluation.

This API lets you evaluate those stored templates and returns the evaluation result.

PurposeMethodURL
Stored template evaluationGEThttp://HOST/tpl/document.cgi?tpl=/tpl/PATH/TEMPLATE.tpl

In the above URL, replace

  • HOST by the host belonging to the device
  • TEMPLATE by the name of the template you want to evaluate
  • PATH by the category the template belongs to

The mapping from categories to paths is:

CategoryPATH
Generalgeneral
Emailemail
Webhookwebhook
info

Historical peripheral data in CSV is a special case of this, where the templates providing the CSV data are vendor provided.

Evaluate templates on the fly

This API endpoint returns an evaluated template, that is supplied inline in the body of the HTTP request.

The template does not have to be stored beforehand on the device to use this method.

PurposeMethodURL
Execute templatePOSThttp://HOST/admin/proctpl.cgi
info

HOST is to be replaced by the host belonging to the device.

Include the template as raw text in the body of the request.

warning

The maximum supported payload size is 4096 bytes.

Control digital outputs and/or check watchdogs

Set the state of digital outputs or perform a watchdog check on demand with this API.

PurposeMethodURL
Control digital outputs and/or check watchdogsPOSThttp://HOST/control.cgi
info

HOST is to be replaced by the host belonging to the device.

To define the behaviour, include one or more of the following parameters
in the application/x-www-form-urlencoded format in the request body.

ParameterDescription
output0Switch output 1 off if the value is 0; otherwise, switch it on.
output1Switch output 2 off if the value is 0; otherwise, switch it on.
watchdog0Check watchdog 1 immediately if the value is greater than 0.
watchdog1Check watchdog 2 immediately if the value is greater than 0.

warning

Providing an API-Key is mandatory here!