Use this endpoint to retrieve raw data from one or multiple variables in a time range
To retrieve raw data from one or multiple variables within a time range, please make a POST request to the following URL:
HTTP Method | URL |
---|---|
POST | https://industrial.api.ubidots.com/api/v1.6/data/raw/series |
Headers
The "X-Auth-Token" and "Content-Type" headers are required to your request:
Header | Value | Required? | Description |
---|---|---|---|
X-Auth-Token | Token | Yes | Authentication Token of account. |
Content-Type | application/json | Yes | The type of data of the body. |
Body
An object containing the following key parameters:
Parameter | Type | Required? | Description |
---|---|---|---|
variables | String Array | Yes | An array of variable IDs |
columns | String Array | Yes | Information columns to retrieve from each variables. See note below for a detailed explanation |
join_dataframes | Boolean | No | true : returns an array. Each element is an array containing the values for the period.false : [Default] returns an array where each element is separate time-series per variable. |
start | Number | No | Initial timestamp in milliseconds POSIX format (inclusive). |
end | Number | No | Final timestamp in milliseconds POSIX format (inclusive). |
limit | Number | No | Limits the number of returned values |
{
"variables": ["618848b4b09758ded46bafda", ···, "618848b7b31be1cb509c0a3c"],
"columns": ["value.value", "timestamp"],
"join_dataframes": false,
"start": 1636321611000,
"end": 1636321629000,
"limit": 3
}
Columns parameter
Options are:
- value.value
- variable.id
- value.context
- variable.name
- varible.properties.color
- device.name
- device.label
- timestamp
Optional parameters
- If neither
start
andend
are included, the request will use the last 100 values of each variable.- If only
start
is sent, it will include values from that timestamp up until the last value in the time series, regardless if it's in the future.- If only
end
is sent, it will includes values from the beginning of data reception up until that timestamp.
Query Parameters
You may add optional parameters to the URL of your request:
Parameter | Type | Description |
---|---|---|
token | String | The token to authenticate the request. While sending it as a query parameter is supported, we strongly recommend using the X-Auth-Token header |
Examples
Get the raw data from multiple variables:
Get 1 hour worth of raw data from multiple variables.
$ curl -X POST 'https://industrial.api.ubidots.com/api/v1.6/data/raw/series' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"variables": ["618848b4b09758ded46bafda", "618848b7b31be1cb509c0a3c"],
"columns": ["value.value", "timestamp"],
"join_dataframes": false,
"start": 1636318800000,
"end": 1636322400000
}'
{
"results": [
[
[
62982.2158,
1636322400000
],
[
62983.0896,
1636321200000
],
[
63038.9567,
1636320000000
],
[
62796.2391,
1636318800000
]
],
[
[
62850.3801,
1636322101553
],
[
62883.235,
1636321804316
],
[
62870.3731,
1636321503773
],
[
62983.0896,
1636321204195
],
[
63038.9567,
1636320901873
],
[
62954.9763,
1636320604142
],
[
62889.5329,
1636320302570
],
[
62804.1109,
1636320003317
],
[
62796.2391,
1636319701865
],
[
62773.1121,
1636319402894
],
[
62752.7116,
1636319101710
],
[
62704.7288,
1636318807253
]
]
],
"columns": [
[
"5b17df86642ab66a5f6037d8.value.value",
"timestamp"
],
[
"5ae73c56bbddbd669ed87e0a.value.value",
"timestamp"
]
]
}
{
"detail": "JSON parse error - Expecting value: line 4 column 22 (char 121)"
}
{
"code": 401001,
"message": "Authentication credentials were not provided."
}
Get the raw data from multiple variables:
Get the last 3 values for multiple variables.
$ curl -X POST 'https://industrial.api.ubidots.com/api/v1.6/data/raw/series' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"variables": ["618848b4b09758ded46bafda", "618848b7b31be1cb509c0a3c"],
"columns": ["value.value", "timestamp"],
"join_dataframes": false,
"limit": 3
}'
{
"results": [
[
[
62982.2158,
1636322400000
],
[
62983.0896,
1636321200000
],
[
63038.9567,
1636320000000
]
],
[
[
62850.3801,
1636322101553
],
[
62883.235,
1636321804316
],
[
62870.3731,
1636321503773
]
]
],
"columns": [
[
"5b17df86642ab66a5f6037d8.value.value",
"timestamp"
],
[
"5ae73c56bbddbd669ed87e0a.value.value",
"timestamp"
]
]
}
{
"detail": "JSON parse error - Expecting value: line 4 column 22 (char 121)"
}
{
"code": 401001,
"message": "Authentication credentials were not provided."
}