This guide provides insights into retrieving and analyzing energy, gas, and water consumption data using the Wia API. You will learn how to configure the flow of data (consumption vs. production), filter data by device properties, and handle timestamps effectively.
- Create your account and log in.
- Navigate to your dashboard to retrieve your API key or, depending on your representative, you may have been sent a key.
- If you don't have an API key, please contact your representative.
Your API key is required to authenticate all API requests.
The Wia API allows you to retrieve energy, gas, and water consumption data. These data points can be grouped by devices, spaces, or countries.
curl -X GET "https://api.wia.io/v1/energy/electricity?space.id=spc_abc123&since=1704067200000&until=1704153600000&flow=consumption" \
-H "Authorization: Bearer YOUR_API_KEY"
space.id
: Specify the space for which you want data.since
: Start of the time range timestamp.until
: End of the time range timestamp.flow
: Set toconsumption
for energy used orproduction
for energy generated.
{
"result": [
{
"energy": "1000",
"timestamp": 1631707200000
},
{
"energy": "1200",
"timestamp": 1631710800000
}
],
"continuationToken": null
}
The process is similar for gas and water data.
curl -X GET "https://api.wia.io/v1/energy/gas?space.id=spc_abc123&since=1704067200000&until=1704153600000&flow=consumption" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -X GET "https://api.wia.io/v1/energy/water?space.id=spc_abc123&since=1704067200000&until=1704153600000&flow=consumption" \
-H "Authorization: Bearer YOUR_API_KEY"
You can group data by devices or countries for more granular analysis.
curl -X GET "https://api.wia.io/v1/energy/electricity?space.id=spc_abc123&since=1704067200000&until=1704153600000&breakdown=device" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"devices": {
"dev_abc123": [
{
"energy": "1000",
"timestamp": 1631707200000
}
],
"dev_def456": [
{
"energy": "1200",
"timestamp": 1631707200000
}
]
}
}
curl -X GET "https://api.wia.io/v1/energy/electricity?since=1704067200000&until=1704153600000&breakdown=country" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"countries": {
"IRL": [
{
"energy": "2000",
"timestamp": 1631707200000
}
],
"DEU": [
{
"energy": "1500",
"timestamp": 1631707200000
}
]
}
}
All timestamps in the API are in UTC. Use the timezone
parameter to adjust data for your local timezone.
curl -X GET "https://api.wia.io/v1/energy/electricity?space.id=spc_abc123&since=1704067200000&until=1704153600000&timezone=Europe/London" \
-H "Authorization: Bearer YOUR_API_KEY"
You can specify the data aggregation interval using the interval
parameter (e.g., 15 minutes
, 1 hour
, 1 day
).
curl -X GET "https://api.wia.io/v1/energy/electricity?space.id=spc_abc123&since=1704067200000&until=1704153600000&interval=1 hour" \
-H "Authorization: Bearer YOUR_API_KEY"
The Wia API provides robust options to retrieve and analyze energy, gas, and water consumption data. You can:
- Choose between
consumption
orproduction
flow. - Group data by
device
orcountry
. - Handle timestamps effectively with
timezone
andinterval
parameters.
Use these features to monitor usage trends, optimize energy management, and make data-driven decisions.