Archival data
Fetching raw archival data
Endpoint
GET /easy/v1/gateways/GATEWAY_ID/SENSOR_ID/data
URL parameters:
from
- start date and timeto
- end date and time (optional)
The date and time format is the same as used in responses, eg: 2020-01-01T12:00Z
.
Timezone
The from
and to
parameters MUST BE provided in UTC
timezone, as indicated by Z
letter ending the date string.
Please consider this when requesting the data.
For example: You are in CET timezone which is UTC+1. To fetch data for a complete single day you have add 1 hour offset. Example parameters:
from
=2020-02-03T23:00:00Z
(3rd Feb 2020 23:00 UTC is 4th Feb 00:00 CEST)to
=2020-02-04T23:00:00Z
(4rd Feb 2020 23:00 UTC is 4th Feb 24:00 CET)
Example requests
export ACCESS_TOKEN="ACCESS_TOKEN"
export GATEWAY_ID="DEMO"
export SENSOR_ID="e1.kwh"
curl -G \
--data-urlencode "from=2021-02-03T23:00:00Z" \
--data-urlencode "to=2021-02-04T23:00:00Z" \
--header "Authorization: Bearer $ACCESS_TOKEN" \
"https://api.rayleighconnect.net/easy/v1/gateways/$GATEWAY_ID/$SENSOR_ID/data.json"
const ACCESS_TOKEN = 'ACCESS_TOKEN';
const api = new rayleighconnect.EasyAPI(ACCESS_TOKEN);
// API call returns a Promise object:
api.fetchData(
'DEMO', // gateway_id
'e1.kwh', // sensor_id
new Date(2021,2,4,0,0,0), // from
new Date(2021,2,5,0,0,0) // to
).then(console.log).catch(console.error);
from datetime import datetime, timedelta
from rayleighconnect import EasyAPI
ACCESS_TOKEN = 'ACCESS_TOKEN'
# dates:
start = datetime(2021,3,4)
end = start + timedelta(hours=24)
api = EasyAPI(ACCESS_TOKEN)
# API call returns a list or None on error:
data = api.fetch_data(gateway_id='DEMO',sensor_id='e1.kwh',start,end)
Example responses
[
["2020-02-04T12:00:00", 1200.15],
["2020-02-04T12:01:00", 1201.65],
["2020-02-04T12:02:00", 1202.25],
["2020-02-04T12:03:00", 1203.35],
["2020-02-04T12:04:00", 1204.85],
["2020-02-04T12:05:00", 1205.75],
["2020-02-04T12:06:00", 1206.55],
]
timestamp,value
"2020-02-04T12:00:00",1200.15,
"2020-02-04T12:01:00",1201.65,
"2020-02-04T12:02:00",1202.25,
"2020-02-04T12:03:00",1203.35,
"2020-02-04T12:04:00",1204.85,
"2020-02-04T12:05:00",1205.75,
"2020-02-04T12:06:00",1206.55
HTTP codes
200 OK
401 Unauthorized
- returned ifAuthorization
header is not present or not valid404 Not Found
- returned if gateway and sensor combination is not found on an account
Access rate limits
By default accessing data via Easy API has following limitations:
-
Up to 4 concurrent requests for a single token.
-
Up to 200.000 (two hundred thousand) records will be returned by a single query. For devices sending data every 1 minute this will allow you to fetch up to 4 months at once.