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/Authentication
Section titled “Authentication”Obtain a token by posting credentials to the Trendz login endpoint:
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_TOKENAccess tokens are valid for 2.5 hours; use the refresh token to obtain a new one before expiry.
Build View Report
Section titled “Build View Report”The primary external endpoint. Returns the computed data for a saved Trendz view.
POST /apiTrendz/publicApi/buildReportContent-Type: application/jsonRequest body
Section titled “Request body”{ "viewConfigId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "rangeStartTs": 1700000000000, "rangeEndTs": 1700086400000, "filters": { "Building": ["Office A", "Office B"] }}| Field | Type | Required | Description |
|---|---|---|---|
viewConfigId | UUID | Yes | ID of the saved Trendz view to execute |
rangeStartTs | long | No | Start of the time range, Unix timestamp in milliseconds |
rangeEndTs | long | No | End of the time range, Unix timestamp in milliseconds |
filters | object | No | Key-value map of filter field names to selected values; filters must be configured in the view |
Response body
Section titled “Response body”{ "columnLabels": ["timestamp", "Building", "avgTemperature"], "dataTable": [ { "timestamp": 1700000000000, "Building": "Office A", "avgTemperature": 21.4 }, { "timestamp": 1700003600000, "Building": "Office A", "avgTemperature": 22.1 } ]}| Field | Type | Description |
|---|---|---|
columnLabels | string[] | Ordered list of column names in the report |
dataTable | object[] | Rows of data; each row is a map of column name to value |
Error responses
Section titled “Error responses”| HTTP status | Reason |
|---|---|
400 Bad Request | The request body is missing required fields or references an invalid view |
429 Too Many Requests | The server-side queue is full; retry after a short delay |
500 Internal Server Error | An error occurred while computing the view report |
Example
Section titled “Example”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 }'