This endpoint sends one or more Dots to Device
To send historical data (i.e. from data loggers) to one or more variables of a Device please make a POST request to the following URL:
HTTP Method | URL |
---|---|
POST | https://industrial.api.ubidots.com/api/v1.6/devices/<device_label>/_/bulk/values |
Where <device_label>
is a string with the label of the Device to which data will be sent to.
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 a set of variable Dots and a global timestamp that will be applied to each value. Variables with an individual timestamp will override the global timestamp.
[
{
"timestamp":"1597620360000",
"temperature": "2",
"humidity": 88
},
{
"timestamp":"1597620000000",
"temperature": {"value": 23, "context": {}, "timestamp": 1597620000001},
"humidity": 33
},
{
"timestamp":"1597619760000",
"temperature": 26,
"humidity": 44
}
]
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 |
type | String | Optional Device Type label to be applied to the Device if the Device doesn't exist yet. Learn more |
Examples
Send historical data to a Device:
Update a Device with historical data of its variables
$ curl -X POST 'https://industrial.api.ubidots.com/api/v1.6/devices/<device_label>/_/bulk/values' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '[
{
"timestamp":"1597620360000",
"temperature": "2",
"humidity": 88
},
{
"timestamp":"1597620000000",
"temperature": {"value": 23, "context": {}, "timestamp": 1597620000001},
"humidity": 33
},
{
"timestamp":"1597619760000",
"temperature": 26,
"humidity": 44
}
]'
{
"results": [
{
"humidity": [
{
"status_code": 201
}
],
"temperature": [
{
"status_code": 201
}
]
},
{
"humidity": [
{
"status_code": 201
}
],
"temperature": [
{
"status_code": 201
}
]
},
{
"humidity": [
{
"status_code": 201
}
],
"temperature": [
{
"status_code": 201
}
]
}
]
}
{
"code": 400001,
"message": "The payload sent is not a valid json document."
}
{
"code": 401001,
"message": "Authentication credentials were not provided."
}