This endpoint sends one or more Dots to multiples Devices
To send historical data (i.e. from data loggers) to one or more variables of multiple Devices please make a POST request to the following URL:
HTTP Method | URL |
---|---|
POST | https://industrial.api.ubidots.com/api/v1.6/devices/_/bulk/values |
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
A list of objects, each containing parameters as follows:
Parameter | Required? | Description |
---|---|---|
device | Yes | Device label to which data will be sent |
timestamp | Yes | Timestamp in milliseconds POSIX format. When present, this timestamp will be applied to all Dots in the values list unless an individual timestamp is sent. |
values | Yes | A list of objects, each containing Dots for one or more variables. |
[
{
"device":"first-device",
"timestamp":1588864653968,
"values":[
{
"temperature":24,
"humidity":88
},
{
"temperature":21,
"humidity":86,
"timestamp":1588864653900
}
]
},
{
"device":"second-device",
"timestamp":1588864653968,
"values":[
{
"temperature":45,
"humidity":{
"value":2,
"timestamp":1588864653900
}
}
]
}
]
Maximum length
The maximum character length for the body is 10kb
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
Send historical data to multiple Devices:
Update multiple Devices with historical data of its variables
$ curl -X POST 'https://industrial.api.ubidots.com/api/v1.6/devices/_/bulk/values' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '[
{
"device":"first-device",
"timestamp":1588864653968,
"values":[
{
"temperature":24,
"humidity":88
},
{
"temperature":21,
"humidity":86,
"timestamp":1588864653900
}
]
},
{
"device":"second-device",
"timestamp":1588864653968,
"values":[
{
"temperature":45,
"humidity":{
"value":2,
"timestamp":1588864653900
}
}
]
}
]'
{
"task_id": "6178a1d0fdaf23a095b8e50b"
}
{
"detail": "JSON parse error - Invalid control character at: line 3 column 30 (char 36)"
}
{
"code": 401002,
"message": "Incorrect authentication credentials."
}