Retrieving Data from the API

Data is retrieved from the API via the /DataPoint/ endpoint.

There are four types of data that can be retrieved:

  1. Live datum
  2. Minute data
  3. Hour data
  4. Day data

Examples of each are shown below:


Live Datum Request

Provides the last datum (i.e. reading value) of the Data Point. This can be useful for widgets and displaying the 'current' value.

The LiveDatum's timeliness depends on how often the Controller sends the data. If the Controller is batching readings and sending them every half hour, the value could be up to half an hour old.

JSON GET Request

<!-- GET -->
https://nexcloud.io/v1.0/DataPoint/123/LiveDatum

JSON GET Response

<!-- RESPONSE -->
200 OK
https://nexcloud.io/v1.0/DataPoint/123/LiveDatum

<!-- HEADER -->
content-type: application/json; charset=UTF-8

<!-- BODY -->
{
  "DataPointID": 123,
  "Value": 246.01,
  "DateTime": "2017-03-21T04:30:00+00:00"
}


Minute Data

This provides data in minute aggregation between the provided start date and end date.

The startdate and enddate are in UNIX millisecond format and are both required.

Each item in the response is an aggregation of the data over a minute. It will contain the DataPointID, PeriodStart in Unix milliseconds, the minimum value recorded in that period, the maximum value recorded in that period, and the aggregate of the values. Under this is an ordered array of times, and an array of values. Finally, at the bottom of the response is an array of TimeValues, which quickly summarise all Items by providing the PeriodStart value, and the Aggregate value, for every entry in the returned period.

JSON GET Request

<!-- GET -->
https://nexcloud.io/v1.0/DataPoint/123/MinuteData

?access_token=123abc123abc       // Your access token here.
startdate=1497085200000          // 2017-06-10T09:00:00+00:00
&enddate=1497088800000           // 2017-06-10T10:00:00+00:00

JSON GET Response

Response
<!-- RESPONSE -->
200 OK
https://nexcloud.io/v1.0/DataPoint/123/LiveDatum

<!-- HEADER -->
content-type: application/json; charset=UTF-8

<!-- BODY -->
{
  "Items": [
    {
      "DataPointID": "123",
      "PeriodStart": "1497087420000",
      "Minimum": "242.53",
      "Maximum": "243.19",
      "Aggregate": "242.86",
      "Times": [
        "1497087438000",
        "1497087467000"
      ],
      "Values": [
        "242.53",
        "243.19"
      ]
    },
    {
      "DataPointID": "123",
      "PeriodStart": "1497088020000",
      "Minimum": "241.86",
      "Maximum": "242.53",
      "Aggregate": "242.195",
      "Times": [
        "1497088038000",
        "1497088067000"
      ],
      "Values": [
        "241.86",
        "242.53"
      ]
    },
    {
      "DataPointID": "123",
      "PeriodStart": "1497088200000",
      "Minimum": "240.7",
      "Maximum": "242.69",
      "Aggregate": "241.695",
      "Times": [
        "1497088210000",
        "1497088238000"
      ],
      "Values": [
        "242.69",
        "240.7"
      ]
    },
    ...
    ...
  ],
  "TimeValues": {
    "1497087420000": "242.86",
    "1497088020000": "242.195",
    "1497088200000": "241.695",
    ...
    ...
  }
}


Hour Data

JSON GET Request

<!-- GET -->
https://nexcloud.io/v1.0/DataPoint/123/HourData

JSON GET Response

<!-- RESPONSE -->
200 OK
https://nexcloud.io/v1.0/DataPoint/123/HourData

<!-- HEADER -->
content-type: application/json; charset=UTF-8

<!-- BODY -->
{
}


Day Data

JSON GET Request

<!-- GET -->
https://nexcloud.io/v1.0/DataPoint/123/DayData

JSON GET Response

<!-- RESPONSE -->
200 OK
https://nexcloud.io/v1.0/DataPoint/123/DayData

<!-- HEADER -->
content-type: application/json; charset=UTF-8

<!-- BODY -->
{
}




NEX Terms of ServiceRequest NEX API access • Copyright © 2017 NEX Data Management Systems Pty Ltd. All rights reserved.