IoT Cores Dashboard APIs

Authentication


The IoT Cores dashboard requires users to authenticate using a bearer token issues by the base IoT Cores API.

A token can be obtained by issueing a POST to https://api.iotcores.com/v0/oauth/token.

The POST body must be application/x-www-form-urlencoded and contain the following fields:

  • grant_type with the value set to password.

  • username with the value set to your username/email address.

  • password with the value set to your password.

  • client with the value aset to a descriptor of your application. E.g. the dashboard uses velocity-dashboard.

If successful you’ll receive a 200 status code response with an application/json body as shown in this example:

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoidXNlciIsIm5hbWVpZCI6ImFjOGUxYmUwLTg4MGUtNGI2My1hZzUyMTkzOSwibmJmIjoxNTM2NjU3OTM5fQ.J2090TZaL-hSWCsifl0KegSe7iuaDkhs87WZKgqDf1c",
    "token_type": "bearer",
    "expires_in": 863999
}

The access_token field needs to be used for authenticating requests to all dashboard APIs. In order to authenticate include an Authorization with the value in the format bearer <access_token>.

Note that the access_token is not valid forever. The expires_in field specifies how many seconds the token will remain valid before it expires. After the token expires it will be rejected and you’ll need to get a new token by authenticating again.

Project Devices

List Project Devices

GET https://dashboard-api.iotcores.com/v0/devices/lx/demo
Responses200
Headers
Content-Type: application/json
Body
[
  {
    "display": "North Paddock",
    "deviceId": "a013170112ecc060",
    "type": "BlueNode",
    "firstContact": "2018-02-13T23:55:58.2375888+00:00",
    "lastContact": "2018-09-11T08:23:57.3806751+00:00",
    "userMeta": {
      "soilTypeOption": 4,
      "soilUnitOption": 0,
      "hide": false
    },
    "state": {
      "sensorUID": {
        "value": 11534588364005884000,
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "sensorUIDHex": {
        "value": "a013170112ecc060",
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "packetId": {
        "value": 901,
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "batteryOkay": {
        "value": true,
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "probeData.serialNumber": {
        "value": "S0000202658",
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "probeData.sensorReading.0.temperature_raw": {
        "value": 168,
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "probeData.sensorReading.1.temperature_raw": {
        "value": 164,
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "probeData.sensorReading.2.temperature_raw": {
        "value": 166,
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "sensorVersion_word": {
        "value": 16779777,
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "baseBlock.loraRSSI_dBm": {
        "value": 66,
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      },
      "nodeTemperature_dC": {
        "value": 224,
        "timestamp": "2018-09-11T08:23:57.3806751+00:00",
        "event": "0000000000fe6c1a"
      }
    }
  }
]

List Project Devices
GET/devices/{organisation}/{project}

URI Parameters
HideShow
organisation
string (required) Example: lx

The name of the organisation the device belongs to.

project
string (required) Example: demo

The name of the project the device belongs to.


Device

Project Device

GET https://dashboard-api.iotcores.com/v0/devices/lx/demo/a013170112ecc060
Responses200
Headers
Content-Type: application/json
Body
{
  "display": "North Paddock",
  "deviceId": "a013170112ecc060",
  "type": "BlueNode",
  "firstContact": "2018-02-13T23:55:58.2375888+00:00",
  "lastContact": "2018-09-11T08:23:57.3806751+00:00",
  "userMeta": {
    "soilTypeOption": 4,
    "soilUnitOption": 0,
    "hide": false
  },
  "state": {
    "sensorUID": {
      "value": 11534588364005884000,
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "sensorUIDHex": {
      "value": "a013170112ecc060",
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "packetId": {
      "value": 901,
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "batteryOkay": {
      "value": true,
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "probeData.serialNumber": {
      "value": "S0000202658",
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "probeData.sensorReading.0.temperature_raw": {
      "value": 168,
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "probeData.sensorReading.1.temperature_raw": {
      "value": 164,
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "probeData.sensorReading.2.temperature_raw": {
      "value": 166,
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "sensorVersion_word": {
      "value": 16779777,
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "baseBlock.loraRSSI_dBm": {
      "value": 66,
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    },
    "nodeTemperature_dC": {
      "value": 224,
      "timestamp": "2018-09-11T08:23:57.3806751+00:00",
      "event": "0000000000fe6c1a"
    }
  }
}

GET Device Detail
GET/devices/{organisation}/{project}/{serial}

URI Parameters
HideShow
organisation
string (required) Example: lx

The name of the organisation the device belongs to.

project
string (required) Example: demo

The name of the project the device belongs to.

serial
string (required) Example: a013170112ecc060

The serial number of the device to remove


PATCH https://dashboard-api.iotcores.com/v0/devices/lx/demo/a01317015604fbff
Responses200
This response has no content.

Update Device Metadata
PATCH/devices/{organisation}/{project}/{serial}

URI Parameters
HideShow
organisation
string (required) Example: lx

The name of the organisation the device belongs to.

project
string (required) Example: demo

The name of the project the device belongs to.

serial
string (required) Example: a01317015604fbff

The serial number of the device to remove


DELETE https://dashboard-api.iotcores.com/v0/devices/lx/demo/a01317015604fbff
Responses200
This response has no content.

Remove Device
DELETE/devices/{organisation}/{project}/{serial}

URI Parameters
HideShow
organisation
string (required) Example: lx

The name of the organisation the device belongs to.

project
string (required) Example: demo

The name of the project the device belongs to.

serial
string (required) Example: a01317015604fbff

The serial number of the device to remove


Timeseries Data

Device Time Series

GET https://dashboard-api.iotcores.com/v0/lx/demo/a0131701757db90/timeseries?rangeStart=2018-09-11T07:50:02&rangeEnd=2018-09-11T08:50:02&fields=humidity_pc,temperature_dC,vibrationData.isVibrating
Responses200
Headers
Content-Type: application/json
Body
{
  "organisation": "Smart Elements",
  "project": "Head Office",
  "deviceId": "a01317fe09f7a990",
  "rangeStart": "2018-09-11T07:50:02.707+00:00",
  "rangeEnd": "2018-09-11T08:50:02.707+00:00",
  "series": {
    "humidity_pc": [
      25,
      25,
      25,
      25,
      25,
      24
    ],
    "temperature_dC": [
      221,
      225,
      220,
      231,
      228,
      236
    ],
    "vibrationData.isVibrating": [
      null,
      null,
      null,
      null,
      null,
      null
    ],
    "timestamp": [
      "2018-09-11T07:55:45.5414039+00:00",
      "2018-09-11T08:06:39.3085374+00:00",
      "2018-09-11T08:15:49.9205904+00:00",
      "2018-09-11T08:26:02.7166261+00:00",
      "2018-09-11T08:35:56.8792886+00:00",
      "2018-09-11T08:45:38.1750121+00:00"
    ]
  }
}

Time Series Data
GET/{organisation}/{project}/{serial}/timeseries{?rangeStart,rangeEnd,fields}

ISO8601 timestamps

📖 The ISO8601 timestamp strings will be assumed to be UTC unless an offset from UTC time is specified e.g. 2018-07-30T16:30+10:00.

URI Parameters
HideShow
organisation
string (required) Example: lx

The name of the organisation the device belongs to.

project
string (required) Example: demo

The name of the project the device belongs to.

serial
string (required) Example: a0131701757db90

The serial number of the device that the data should be loaded for

rangeStart
ISO8601 string (required) Example: 2018-09-11T07:50:02

The time to begin loading data from. If no time offset is specified then it will be assumed to be UTC.

rangeEnd
ISO8601 string (required) Example: 2018-09-11T08:50:02

The cut off time for the last data entry to load.

fields
string (required) Example: humidity_pc,temperature_dC,vibrationData.isVibrating

Comma separated list of values to fetch.


Generated by aglio on 11 Sep 2018