1.4 KiB
The electricity-server REST API
This project depends on the pistache HTTP framework, see their website for more info.
Endpoints
All endpoints respond in JSON. Examples can be found in the Examples section. Dates are always in ISO format, meaning they take the shape of year-month-day with leading zeroes for month and day. Example: 2019-01-11 is the eleventh day of January, 2019.
/day?start=[yyyy-MM-dd]This tells the server what date to serve all the collected records from the specified day./day?start=[yyyy-MM-dd]&stop=[yyyy-MM-dd]This tells the server what date range to serve a per day summary for.
Example Response /day?start=2020-01-10
Will give you as many objects as there are recorded values for the 10th of January, 2020. Ordered from earliest to latest. If there are no records for the given day an empty array is returned.
[
{
"dateTime":1578614401,
"totalPowerUse":3282.95,
"totalPowerReturn":2790.88,
"totalGasUse":3769.23
},
...
]
Example Response /day?start=2020-01-01&stop=2020-01-19
Will give you a summary for each recorded day in the range 1st of January 2020 to the 19th of January 2020. If no logs exist for the day on the server it will send an object with a valid dateTime for that day but with 0 values for the other fields.
[
{
"dateTime":1578614401,
"totalPowerUse": 8.324,
"totalPowerReturn": 3.62,
"totalGasUse": 11.05
},
...
]