eGauge WebAPI (4.6)

eGauge Meter API

Download OpenAPI description
Languages
Servers
Mock server
https://webapi.egauge.net/_mock/webapi/4.6/openapi/
The WebAPI server
https://{devname}.egauge.io/api/

Introduction

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.

/auth

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.

Operations

/capture

The capture service allows collecting waveform data for configured input channels.

Operations

/cmd

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).

Operations

/config

The meter configuration service.

The endpoints under /config provide common method semantics and atomicity guarantees as described below.

Operations

/config/alert

The alert configuration of the meter.

Operations

/config/alert/custom

Up to 32 custom alerts.

Custom alerts consist of an arbitrary boolean condition that is checked at certain times. When the condition evaluates to true, the alert is triggered.

Operations

/config/alert/custom/{idx}

The custom alert.

Operations

/config/alert/custom/{idx}/cond

The boolean condition consists of three parts: lhs op rhs. lhs and rhs are arbitrary expressions and op must be a comparison operator.

Operations

Get /config/alert/custom/{idx}/cond

Request

Path
idxinteger>= 0required

The index of a custom alert.

Query
max-depthinteger>= 1

Limit output depth of the response. See Max-Depth.

Example: max-depth=2
filterstring
Example: filter={foo,bar}
curl -i -X GET \
  'https://webapi.egauge.net/_mock/webapi/4.6/openapi/config/alert/custom/{idx}/cond?filter=string&max-depth=1' \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>'

Responses

Normal response.

Headers
ETagstring

The returned value is a tag that uniquely identifies the meter configuration. Subsequent modification requests can include this tag in an If-Match header to apply the modification only if the configuration has changed since the tag was obtained.

Bodyapplication/json
resultobject(configAlertCustomItemCond)

The boolean condition consists of three parts: lhs op rhs. lhs and rhs are arbitrary expressions and op must be a comparison operator.

errorstring(ErrorString)

A message describing the first error that occurred. This member is present only if an error occurred.

Response
application/json
{ "result": { "lhs": "temp_internal()", "op": "<", "rhs": "30" }, "error": "Error message (present if an error occurred)." }

Replace /config/alert/custom/{idx}/cond

Request

Path
idxinteger>= 0required

The index of a custom alert.

Bodyapplication/json
lhsstring(configAlertCustomItemCondLhs)

An eScript expression that returns the value to use on the left hand side of the comparison.

opstring(configAlertCustomItemCondOp)

The comparison-operator to use for comparing the left-hand-side expression lhs against the right-hand side expression rhs. It may be one of:

  • <: Condition is true if lhs is less than rhs.
  • <=: Condition is true if lhs is less-than-or-equal to rhs.
  • =: Condition is true if lhs is equal to rhs.
  • !=: Condition is true if lhs differs from rhs.
  • >=: Condition is true if lhs is greater-than-or-equal to rhs.
  • >: Condition is true if lhs is greater than rhs.
Enum"<""<=""=""!="">="">"
rhsstring(configAlertCustomItemCondRhs)

An eScript expression that returns the value that to use on the right hand side of the comparison.

curl -i -X PUT \
  'https://webapi.egauge.net/_mock/webapi/4.6/openapi/config/alert/custom/{idx}/cond' \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "lhs": "temp_internal()",
    "op": "<",
    "rhs": "30"
  }'

Responses

Normal response.

Bodyapplication/json
statusstring

A string describing the successful completion of an operation.

Example: "OK"
errorstring(ErrorString)

A message describing the first error that occurred. This member is present only if an error occurred.

Response
application/json
{ "status": "OK", "error": "Error message (present if an error occurred)." }

Update /config/alert/custom/{idx}/cond

Request

Path
idxinteger>= 0required

The index of a custom alert.

Bodyapplication/json
lhsstring(configAlertCustomItemCondLhs)

An eScript expression that returns the value to use on the left hand side of the comparison.

opstring(configAlertCustomItemCondOp)

The comparison-operator to use for comparing the left-hand-side expression lhs against the right-hand side expression rhs. It may be one of:

  • <: Condition is true if lhs is less than rhs.
  • <=: Condition is true if lhs is less-than-or-equal to rhs.
  • =: Condition is true if lhs is equal to rhs.
  • !=: Condition is true if lhs differs from rhs.
  • >=: Condition is true if lhs is greater-than-or-equal to rhs.
  • >: Condition is true if lhs is greater than rhs.
Enum"<""<=""=""!="">="">"
rhsstring(configAlertCustomItemCondRhs)

An eScript expression that returns the value that to use on the right hand side of the comparison.

curl -i -X POST \
  'https://webapi.egauge.net/_mock/webapi/4.6/openapi/config/alert/custom/{idx}/cond' \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "lhs": "temp_internal()",
    "op": "<",
    "rhs": "30"
  }'

Responses

Normal response.

Bodyapplication/json
statusstring

A string describing the successful completion of an operation.

Example: "OK"
errorstring(ErrorString)

A message describing the first error that occurred. This member is present only if an error occurred.

Response
application/json
{ "status": "OK", "error": "Error message (present if an error occurred)." }

Delete /config/alert/custom/{idx}/cond

Request

Reset to default condition which is always false.

Path
idxinteger>= 0required

The index of a custom alert.