This endpoint retrieves variable Dots
To get Dots of a variable please make a GET request to the following URL:
HTTP Method | URL |
---|---|
GET | https://industrial.api.ubidots.com/api/v1.6/devices/<device_label>/<variable_label>/values |
Where <device_label>
and <variable_label>
are the label of the Device and Variable, respectively, from which the last value will retrieved.
Default behaviour
By default, this endpoint will retrieve the last 100 Dots of the specified variable. Use the query params to filter the request further.
Headers
The "X-Auth-Token" header is required for your request:
Header | Value | Required? | Description |
---|---|---|---|
X-Auth-Token | Token | Yes | Authentication Token of account. |
Query Parameters
You may add optional parameters to the URL of your request:
Parameter | Value | Type | Description |
---|---|---|---|
token | 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 |
page | Number | Integer | A page number within the paginated result set. |
page_size | Number | Integer | Number of results to return per page. |
start | Number | Integer | Initial timestamp in milliseconds POSIX format for values of the variable (inclusive). |
end | Number | Integer | Final timestamp in milliseconds POSIX format for values of the variable (inclusive). |
format | json , csv | String | Format to retrieve the data. Defaults to json |
Examples
Get last Dot of a variable:
Retrieves the last Dot of a variable
$ curl -X GET 'https://industrial.api.ubidots.com/api/v1.6/devices/<device_label>/<variable_label>/values/?page_size=1' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73'
{
"count": true,
"next": "https://industrial.api.ubidots.com/api/v1.6/devices/demo/demo/values/?page_size=1&page=2",
"previous": null,
"results": [
{
"timestamp": 1635264014782,
"value": 0,
"context": {},
"created_at": 1635264014782
}
]
}
{
"code": 401002,
"message": "Incorrect authentication credentials."
}
Get last two Dots of a variable:
Retrieves the last two Dot of a variable
$ curl -X GET 'https://industrial.api.ubidots.com/api/v1.6/devices/<device_label>/<variable_label>/values/?page_size=2' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73'
{
"count": true,
"next": "https://industrial.api.ubidots.com/api/v1.6/devices/demo/demo/values/?page_size=2&page=2",
"previous": null,
"results": [
{
"timestamp": 1635264014782,
"value": 0,
"context": {},
"created_at": 1635264014782
},
{
"timestamp": 1635264000173,
"value": 0,
"context": {},
"created_at": 1635264000173
}
]
}
{
"code": 401002,
"message": "Incorrect authentication credentials."
}
Get Dots of a variable in a time range:
Retrieves a list of Dots of a variable between 21/10/2021 00:00:00 and 21/10/2021 00:30:00
$ curl -X GET 'https://industrial.api.ubidots.com/api/v1.6/devices/<device_label>/<variable_label>/values/?start=1634792400000&end=1634794200000' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73'
{
"count": true,
"next": null,
"previous": null,
"results": [
{
"timestamp": 1634793902308,
"value": 65084.81,
"context": {
"Currency": "USD"
},
"created_at": 1634793902308
},
{
"timestamp": 1634793603356,
"value": 65006.39,
"context": {
"Currency": "USD"
},
"created_at": 1634793603356
},
{
"timestamp": 1634793302168,
"value": 65120.26,
"context": {
"Currency": "USD"
},
"created_at": 1634793302168
},
{
"timestamp": 1634793002218,
"value": 65085.38,
"context": {
"Currency": "USD"
},
"created_at": 1634793002218
},
{
"timestamp": 1634792701662,
"value": 64896.85,
"context": {
"Currency": "USD"
},
"created_at": 1634792701662
},
{
"timestamp": 1634792406359,
"value": 65114.12,
"context": {
"Currency": "USD"
},
"created_at": 1634792406359
}
]
}
{
"code": 401002,
"message": "Incorrect authentication credentials."
}
Get Dots of a variable from a date:
Retrieves a list of Dots of a variable from 21/10/2021 00:00:00 up to today
$ curl -X GET 'https://industrial.api.ubidots.com/api/v1.6/devices/<device_label>/<variable_label>/values/?start=1634792400000' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73'
// The "results" list has been chunked because it is too long
{
"count": true,
"next": "https://industrial.api.ubidots.com/api/v1.6/devices/foreignexchange/bitcoin/values/?start=1634792400000&page=2",
"previous": null,
"results": [
{
"timestamp": 1635368101148,
"value": 58920.82,
"context": {
"Currency": "USD"
},
"created_at": 1635368101148
},
···
,
{
"timestamp": 1635367802869,
"value": 58759.25,
"context": {
"Currency": "USD"
},
"created_at": 1635367802869
}
]
}
{
"code": 401002,
"message": "Incorrect authentication credentials."
}
Get Dots of a variable in a time range in CSV format:
Retrieves a list of Dots of a variable from 21/10/2021 00:00:00 and 21/10/2021 00:30:00 in CSV format
$ curl -X GET 'https://industrial.api.ubidots.com/api/v1.6/devices/<device_label>/<variable_label>/values/?start=1634792400000&end=1634794200000&format=csv' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73'
context.Currency,created_at,human_readable_date,timestamp,value
USD,1634793902308,2021-10-21 01:25:02.308000-04:00,1634793902308,65084.81
USD,1634793603356,2021-10-21 01:20:03.356000-04:00,1634793603356,65006.39
USD,1634793302168,2021-10-21 01:15:02.168000-04:00,1634793302168,65120.26
USD,1634793002218,2021-10-21 01:10:02.218000-04:00,1634793002218,65085.38
USD,1634792701662,2021-10-21 01:05:01.662000-04:00,1634792701662,64896.85
USD,1634792406359,2021-10-21 01:00:06.359000-04:00,1634792406359,65114.12
{
"code": 401002,
"message": "Incorrect authentication credentials."
}