Get Variable Data Series
Returns the recorded time series data for the specified variable. By default, the API returns data for the last 6 hours. You can also request data for a custom time range of up to 6 hours.
Endpoint
Section titled “Endpoint”GET /rest/v1/workspaces/{workspace_uuid}/devices/{device_identifier}/variables/{variable_identifier}/dataHeaders
Section titled “Headers”| Header | Value |
|---|---|
Authorization | Bearer <YOUR_API_KEY> |
Content-Type | application/json |
Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
workspace_uuid | String | Yes | Unique identifier of the workspace. |
device_identifier | String | Yes | Unique identifier of the device within the workspace. |
variable_identifier | String | Yes | Unique identifier of the variable within the device. |
Query Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
from | Integer (Unix ms) | No | Start of the time range in Unix milliseconds. Must be provided together with to. |
to | Integer (Unix ms) | No | End of the time range in Unix milliseconds. Must be provided together with from. |
- If neither
fromnortois provided, the API returns data for the last 6 hours, ending at the current UTC time. - The
fromandtoparameters must always be provided together. - The requested time range (
to - from) cannot exceed 6 hours. - Future timestamps are not allowed.
- The
totimestamp must be greater than thefromtimestamp.
Example Request (Default Range)
Section titled “Example Request (Default Range)”GET /rest/v1/workspaces/01KXYZ123456789/devices/PLANT/variables/CURRENT/dataAuthorization: Bearer <YOUR_API_KEY>Example Request (Custom Range)
Section titled “Example Request (Custom Range)”GET /rest/v1/workspaces/01KXYZ123456789/devices/PLANT/variables/CURRENT/data?from=1783653843000&to=1783664643000Authorization: Bearer <YOUR_API_KEY>Success Response
Section titled “Success Response”Status: 200 OK
{ "data": { "size": 6, "data_points": [ { "t": 1784027551299, "v": 230.13978 }, { "t": 1784027672208, "v": 48.96483 }, { "t": 1784027794580, "v": 76.26026 }, { "t": 1784027915526, "v": 138.98396 }, { "t": 1784028036612, "v": 191.62514 }, { "t": 1784028157462, "v": 224.28469 } ] }, "meta": { "message": "Variable data series fetched successfully", "success": true }}Response Fields
Section titled “Response Fields”| Field | Description |
|---|---|
data.size | Total number of data points returned. |
data.data_points | Array of recorded data points. |
data.data_points[].t | Timestamp of the recorded value in Unix milliseconds (UTC). |
data.data_points[].v | Recorded value at the specified timestamp. The value type depends on the variable’s data type (for example, Number, Boolean, or String). |
Errors
Section titled “Errors”| HTTP Status | Description |
|---|---|
| 400 Bad Request | One or more request parameters are invalid. This includes missing path parameters, providing only one of from or to, invalid timestamp formats, to earlier than from, a time range exceeding 6 hours, or future timestamps. |
| 401 Unauthorized | Authentication failed due to a missing or invalid API key. |
| 404 Not Found | The specified workspace, device, or variable could not be found. |
| 500 Internal Server Error | An unexpected error occurred while retrieving the requested data. |