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:
- Live datum
- Minute data
- Hour data
- 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
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 Service • Request NEX API access • Copyright © 2017 NEX Data Management Systems Pty Ltd. All rights reserved.