Skip to content
Stand with Ukraine flag

REST API

The Trendz REST API lets you fetch view data programmatically — for example, to pull computed telemetry into external dashboards, scripts, or third-party tools.

All endpoints are served under the base URL:

http(s)://<trendz-host>:8888/apiTrendz/

Obtain a token by posting credentials to the Trendz login endpoint:

Terminal window
curl -X POST 'http://localhost:8888/apiTrendz/publicApi/auth/login' \
-H 'Content-Type: application/json' \
-d '{"username": "[email protected]", "password": "tenant"}'

Response:

{"token": "YOUR_JWT_TOKEN", "refreshToken": "YOUR_JWT_REFRESH_TOKEN"}

Pass the token in the X-Authorization header of subsequent requests:

X-Authorization: Bearer YOUR_JWT_TOKEN

Access tokens are valid for 2.5 hours; use the refresh token to obtain a new one before expiry.

The primary external endpoint. Returns the computed data for a saved Trendz view.

POST /apiTrendz/publicApi/buildReport
Content-Type: application/json
{
"viewConfigId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"rangeStartTs": 1700000000000,
"rangeEndTs": 1700086400000,
"filters": {
"Building": ["Office A", "Office B"]
}
}
FieldTypeRequiredDescription
viewConfigIdUUIDYesID of the saved Trendz view to execute
rangeStartTslongNoStart of the time range, Unix timestamp in milliseconds
rangeEndTslongNoEnd of the time range, Unix timestamp in milliseconds
filtersobjectNoKey-value map of filter field names to selected values; filters must be configured in the view
{
"columnLabels": ["timestamp", "Building", "avgTemperature"],
"dataTable": [
{ "timestamp": 1700000000000, "Building": "Office A", "avgTemperature": 21.4 },
{ "timestamp": 1700003600000, "Building": "Office A", "avgTemperature": 22.1 }
]
}
FieldTypeDescription
columnLabelsstring[]Ordered list of column names in the report
dataTableobject[]Rows of data; each row is a map of column name to value
HTTP statusReason
400 Bad RequestThe request body is missing required fields or references an invalid view
429 Too Many RequestsThe server-side queue is full; retry after a short delay
500 Internal Server ErrorAn error occurred while computing the view report
Terminal window
curl -X POST "http://localhost:8888/apiTrendz/publicApi/buildReport" \
-H "Content-Type: application/json" \
-H "X-Authorization: Bearer <jwt-token>" \
-d '{
"viewConfigId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"rangeStartTs": 1700000000000,
"rangeEndTs": 1700086400000
}'