A REST API is available for Fabriq OS Pro users who have the API included in their subscriptions.
Information regarding how the API can be used for a specific account can be accessed under 'Analytics':
Calls are available for the following information to be retrieved:
- How sites are structured on a hierarchy within the platform
- Information regarding any site or unit
- Data sets housed within meters organised as in a time series
curl (https://curl.haxx.se/) can be used to trigger calls to retrieve data of interest. For example, to retrieve information regarding a hierarchy, a call similar to the following can be used, which would generate an appropriate response:
curl -X GET -H "Authorization: Bearer UUxaxOdJc5kcXFq1OUZOQnIGH0M1B1" "https://platform.fabriq.space/api/content/"
RESPONSE:
{
"id": "site:10lrzfp18",
"series_id": null,
"content_type": "site",
"items": [
{
"id": "metering_point:pd5m125d31xg6",
"series_id": "hm:36352", <<< Total Site Series
"content_type": "metering_point",
"is_total": true, << Total=True
"title": "Dunedin House",
"subtitle": "Total"
},
],
"is_total": false,
"title": "Dunedin House",
"subtitle": null
},
Similarly, to retrieve a data set of interest, the following call can be used:
curl -X GET -H "Authorization: Bearer UUxaxOdJc5kcXFq1OUZOQnIGH0M1B1" "https://platform.fabriq.space/api/series/hm:36352/?start_date=2018-01-10&end_date=2018-01-20&resolution=day"
RESPONSE:
{
"start_date": "2018-01-10T00:00:00",
"series_id": "hm:36352",
"data_points": {
"2018-01-13T00:00:00.000Z": 1802.66,
"2018-01-18T00:00:00.000Z": 2551.38,
"2018-01-19T00:00:00.000Z": 2674.31,
"2018-01-16T00:00:00.000Z": 2648.17,
"2018-01-12T00:00:00.000Z": 2590.22,
"2018-01-10T00:00:00.000Z": 2780.57,
"2018-01-17T00:00:00.000Z": 2656.9,
"2018-01-15T00:00:00.000Z": 2662.02,
"2018-01-20T00:00:00.000Z": 1899.44,
"2018-01-14T00:00:00.000Z": 1802.23,
"2018-01-11T00:00:00.000Z": 2526.89
},
"end_date": "2018-01-20T00:00:00",
"unit": "kWh",
"resolution": "day"
}
Note that authentication support via OAUTH2 is available. Applicable access tokens can be included into each call for authentication purposes.