eGauge Meter API
eGauge Meter API
The eGauge WebAPI is a JSON-based API that provides access to eGauge meters. It offers secure means to read device data, configure the device, and perform various control operations.
The WebAPI is intended to eventually replace the eGauge XML API. For new applications, developers are encouraged to use WebAPI rather than the legacy XML API.
The authentication service. Clients can use this to obtain and manage tokens that grant access to the other resources in this API.
The meter uses JSON Web Tokens (JWT or simply token) to restrict access to protected resources. Clients must include such tokens in requests via the HTTP Authorization header. This header must have the form:
Authorization: Bearer JWT
where JWT is a valid token.
Tokens are valid for a limited time; typically for about 10 minutes. However, a meter may revoke a token earlier, e.g., due to a reboot.
The service provides the ability to execute various operations for their side effects, such as rebooting the meter. Unless stated otherwise, the resources in this service are available only to users with the save right (see /auth/rights).
curl -i -X GET \ 'https://webapi.egauge.net/_mock/webapi/4.6/openapi/config/alert/custom?filter=string&max-depth=1' \ -H 'Authorization: Bearer <YOUR_JWT_HERE>'
{ "result": [ { … } ], "error": "Error message (present if an error occurred)." }
Alert detail message. This may be up to 255 bytes in length. The following sequences within this string get replaced as follows:
%%
is replaced by a single percent character.%l
is replaced by the value of the lhs
expression.%r
is replaced by the value of the rhs
expression.%L
is replaced by the lhs
expression string.%R
is replaced by the rhs
expression string.The frequency with which this custom alert should be checked. Possible values are:
sec
: The alert will be checked once a second.min
: The alert will be checked once a minute.hr
: The alert will be checked once an hour.dy
: The alert will be checked once a day.wk
: The alert will be checked once a week.mon
: The alert will be checked once a month.an
: The alert will be checked once a year.The priority of this custom alert. Zero is the lowest, seven the highest priority.
The boolean condition consists of three parts: lhs op rhs
. lhs
and rhs
are arbitrary expressions and op
must be a comparison operator.
curl -i -X PUT \ https://webapi.egauge.net/_mock/webapi/4.6/openapi/config/alert/custom \ -H 'Authorization: Bearer <YOUR_JWT_HERE>' \ -H 'Content-Type: application/json' \ -d '[ { "name": "temperature alert", "detail": "It is hot in here: %l C!", "frequency": "sec", "priority": 7, "cond": { "lhs": "temp_internal()", "op": "<", "rhs": "30" } } ]'
{ "status": "OK", "error": "Error message (present if an error occurred)." }
Alert detail message. This may be up to 255 bytes in length. The following sequences within this string get replaced as follows:
%%
is replaced by a single percent character.%l
is replaced by the value of the lhs
expression.%r
is replaced by the value of the rhs
expression.%L
is replaced by the lhs
expression string.%R
is replaced by the rhs
expression string.The frequency with which this custom alert should be checked. Possible values are:
sec
: The alert will be checked once a second.min
: The alert will be checked once a minute.hr
: The alert will be checked once an hour.dy
: The alert will be checked once a day.wk
: The alert will be checked once a week.mon
: The alert will be checked once a month.an
: The alert will be checked once a year.The priority of this custom alert. Zero is the lowest, seven the highest priority.
The boolean condition consists of three parts: lhs op rhs
. lhs
and rhs
are arbitrary expressions and op
must be a comparison operator.
curl -i -X POST \ https://webapi.egauge.net/_mock/webapi/4.6/openapi/config/alert/custom \ -H 'Authorization: Bearer <YOUR_JWT_HERE>' \ -H 'Content-Type: application/json' \ -d '[ { "name": "temperature alert", "detail": "It is hot in here: %l C!", "frequency": "sec", "priority": 7, "cond": { "lhs": "temp_internal()", "op": "<", "rhs": "30" } } ]'
{ "status": "OK", "error": "Error message (present if an error occurred)." }