PowerBI
Data Setup
Configure API
Go to Get data -> Blank Query
Open a blank query for editing.

Click on Advanced Editor.

Enter the following sample query:
let
// API URL
apiUrl = "https://www.weincloud.net/dashboard/api/v2/open_api/history",
// Get UTC
endDate = DateTimeZone.UtcNow(),
// previous 3 hours
startDate = endDate - #duration(0, 3, 0, 0),
// to ISO8601
formattedStartDate = DateTimeZone.ToText(startDate, "yyyy-MM-ddTHH:mm:ssZ"),
formattedEndDate = DateTimeZone.ToText(endDate, "yyyy-MM-ddTHH:mm:ssZ"),
// JSON body
requestBody = Json.FromValue([
start = formattedStartDate,
end = formattedEndDate,
tags = {
[
hw_key = "Please Input Your HWKEY HERE !!!",
name = "Please Input Your Tag Name HERE !!!"
]
}
]),
// HTTP request header
requestHeaders = [
#"Content-Type" = "application/json",
#"X-API-KEY" = "Please Input Your API KEY HERE !!!"
],
// POST request
Source = Web.Contents(
apiUrl,
[
Headers = requestHeaders,
Content = requestBody,
Timeout = #duration(0, 0, 5, 0)
]
),
// JSON response
raw = Json.Document(Source),
dList = raw[d],
// expand array
dTable = Table.FromList(dList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
dExpanded = Table.ExpandRecordColumn(dTable, "Column1", {"hw_key", "name", "values"}),
valuesExpanded = Table.ExpandListColumn(dExpanded, "values"),
valuesFlattened = Table.ExpandRecordColumn(valuesExpanded, "values", {"value", "hmi_time"}),
// change value to number
#"Changed Type" = Table.TransformColumnTypes(valuesFlattened, {{"value", type number}}),
// hmi_time to date time type
withDateTime = Table.AddColumn(
#"Changed Type",
"hmi_datetime",
each DateTime.From(#datetime(1970, 1, 1, 0, 0, 0) + #duration(0, 0, 0, [hmi_time] / 1000)),
type datetime
)
in
withDateTimeEdit Credentials

Select the API URL:
Global Service: https://www.weincloud.net/dashboard/api/v2/open_api/history
China Service: https://www.weincloud.net.cn/dashboard/api/v2/open_api/history

Close and save.

Create Chart
Select LineChart.

Place hmi_datetime in the X-axis.

Choose to use the raw data directly.

Place value in the Y-axis and choose your desired aggregation method.

Chart creation is complete.
