Telemetry

Telemetry

You will need a {deviceId} from the Get devices request

Get latest telemetry

Gets the latest telemetry values for a device. This will return the values that the device measures which depends on the device type (e.g. pH, temperature, electrical conductivity).

You can only call this endpoint once per minute per device

Request

GET
https://api.edenic.io/api/v1/telemetry/{deviceId}

Query parameters


keys string optional

A comma-separated list of telemetry keys. By default all will be returned.

Available values: ph, electrical_conductivity, temperature.


Response

The "ts" value is a timestamp in milliseconds since epoch

200 OK - Example
{
  "temperature": [
    {
      "ts": 1684130105629,
      "value": "18.36"
    }
  ],
  "electrical_conductivity": [
    {
      "ts": 1684130105629,
      "value": "0.89"
    }
  ],
  "ph": [
    {
      "ts": 1684130105629,
      "value": "6.27"
    }
  ]
}

Get telemetry history

Gets the telemetry history between a specified time period for a device. This will return the values that the device measures which depends on the device type (e.g. pH, temperature, electrical conductivity).

You can only call this endpoint once per minute per device

Request

GET
https://api.edenic.io/api/v1/telemetry/{deviceId}

Query parameters

Use the parameters below to get telemetry on intervals between two times. You may need to convert the times from milliseconds since epoch to human readable dates to understand the values better.

There is a maximum of 500 points available on each call and a minimum interval of 1 minute


keys string required

A comma-separated list of telemetry keys.

Available values: ph, electrical_conductivity, temperature.


startTs bigint required

The start timestamp in milliseconds since epoch e.g. 1684130105629.


endTs bigint required

The end timestamp in milliseconds since epoch e.g. 1684130105629.


interval bigint optional

The time interval in milliseconds between each value e.g. 600000.

To get the maximum interval, subtract the startTs from the endTs and divide by 500. Any value higher will not be allowed through the API.


agg string optional

A string value representing the aggregation function. Defaults to NONE.

If your aggregate function is set to NONE you will only get the last 2 hours of data and the interval is not used.

Available values: AVG, COUNT, MAX, MIN, NONE, SUM.


orderBy string optional

Sort order. ASC (ascending) or DESC (descending).


Response

The "ts" value is a timestamp in milliseconds since epoch

200 OK - Example
{
    "temperature": [
        {
            "ts": 1684130105629,
            "value": "18.36"
        },
        {
            "ts": 1684130205629,
            "value": "18.42"
        }
        ...
    ],
    "electrical_conductivity": [
        {
            "ts": 1684130105629,
            "value": "0.89"
        },
        {
            "ts": 1684130205629,
            "value": "0.86"
        }
        ...
    ],
    "ph": [
        {
            "ts": 1684130205629,
            "value": "6.27"
        },
        {
            "ts": 1684130205629,
            "value": "6.27"
        }
        ...
    ]
}

Example

Here is an example request to get the average telemetry every 1 hour 26 minutes and 24 seconds for the last 30 days between June 23, 2023 and July 23, 2023 (UTC time) using cURL.

cURL example
curl --include --get https://api.edenic.io/api/v1/telemetry/12345678-1234-1234-1234-123456789012 \
  --header 'Authorization: ed_1234567890123456789012345789012345678901234567890123456789012345' \
  --data 'keys=temperature,electrical_conductivity,ph' \
  --data 'startTs=1687564004466' \
  --data 'endTs=1690156004466' \
  --data 'interval=5184000' \
  --data 'agg=AVG' \
  --data 'orderBy=ASC'

This will format the URL to look like:

https://api.edenic.io/api/v1/telemetry/12345678-1234-1234-1234-123456789012?keys=temperature,electrical_conductivity,ph&startTs=1687564004466&endTs=1690156004466&interval=5184000&agg=AVG&orderBy=ASC
Example response
{
  "temperature": [
    {
      "ts": 1687564004466,
      "value": "12.00"
    },
    {
      "ts": 1687569188466,
      "value": "14.00"
    },
    {
      "ts": 1687574372466,
      "value": "16.00"
    },
    ...
  ],
  "electrical_conductivity": [
    {
      "ts": 1687564004466,
      "value": "0.60"
    },
    {
      "ts": 1687569188466,
      "value": "0.70"
    },
    {
      "ts": 1687574372466,
      "value": "0.60"
    },
    ...
  ],
  "ph": [
    {
      "ts": 1687564004466,
      "value": "7.10"
    },
    {
      "ts": 1687569188466,
      "value": "7.10"
    },
    {
      "ts": 1687574372466,
      "value": "7.00"
    },
    ...
  ],
}