Cloud Services API Reference

Query Time Trend of Energy Data

Last Updated on : 2023-06-21 07:13:04download

Query energy statistics data under assets or under custom dimensions within a specified time range, including the usage, generation, or dump statistics with respect to water, electricity, and natural gas.

API address

GET: /v1.0/iot-03/energy/{energy_type}/statistics

Request parameter

Parameter name Type IN Required Description
energy_type String uri true The energy type. Set the value to electricity.
energy_action String query true The energy behavior. Set the value to consume, representing energy consumption.
dimension_code String query true The code of a specified dimension. Valid value: asset or other custom dimension.
node_ids String query true The IDs of the specified dimension nodes. Maximum value: 10.
statistics_type String query true The statistical type. Valid values:
  • month: by month, in the format of yyyyMM. The maximum span is 12 months, and you can only query the data of the last 12 months.
  • day: by day, in the format of yyyyMMdd. The maximum span is 7 days, and you can only query the data of the last 90 days.
  • hour: by hour, in the format of yyyyMMddHH. The maximum span is 24 hours, and you can only query the data of the last 7 days.
start_time String query true The start time.
end_time String query true The end time.

Return parameter

Parameter name Type Description
result List The returned result.

Description of result

Parameter name Type Description
node_id String The ID of a specified dimension node.
items List The time trend of the energy data.

Description of items

Parameter name Type Description
time String The time.
value Float The energy data.

Request example

GET: /v1.0/iot-03/energy/electricity/statistics?energy_action=consume&dimension_code=asset&node_ids=138803317715****&statistics_type=hour&start_time=2021080422&end_time=2021080423

Return example

{ "result": [ { "items": [ { "time": "2021080400", "value": 10 }, { "time": "2021080401", "value": 20 } ], "node_id": "123432" }, { "items": [ { "time": "2021080400", "value": 10 }, { "time": "2021080401", "value": 20 } ], "node_id": "2423232" } ], "t": 1624525873263, "success": true }

Error code

For more information, see error code.