This endpoint creates multiple new Devices.
Request
To create multiple new Devices please make a POST request to the following URL:
| HTTP Method | URL |
|---|---|
| POST | https://industrial.api.ubidots.com/api/v2.0/devices/_/bulk/create/ |
Query Parameters
| Parameter | Type | Use | Description |
|---|---|---|---|
| token | String | Authentication | Authentication Token can optionally be sent as a query parameter. |
Body Parameters
The body is an Array containing Device JSON objects. Each Device object can contain the following body parameters:
| Parameter | Type | Required? | Default Value | Description |
|---|---|---|---|---|
| label | String | Yes | N/A (required) | API label of Device |
| name | String | No | Same as label | Name of Device |
| description | String | No | "" | Description of Device |
| tags | String Array | No | [ ] | Device tags |
| properties | Object | No | { } | Device properties. Allowed attributes: _icon, _color, _location_type, _location_variable (label of Variable), _location_fixed, _config |
| organization | String | No | null | Organization of Device |
Header
Don't forgetPlease note that the
X-Bulk-Operationheader attribute is necessary Learn more.
| Parameter | Type | Description |
|---|---|---|
| X-Auth-Token | String | Authentication Token of account |
| X-Bulk-Operation | Boolean | Need to be set to True for the bulk operation to work |
| Content-Type | String (application/json) | Content type of body |
curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/devices/_/bulk/create/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-H 'X-Bulk-Operation: True' \
-d '[
{
"label": "device_1",
"properties": {
"_location_type":"manual",
"_location_fixed": {
"lat": 6.2486,
"lng": 75.5742
}
}
},
{
"label": "device_2",
"tags": ["Colombia", "Medellin", "IoTIsGreat"]
},
{
"label": "device_3",
"properties": {},
"description":"This is the description for device_3"
}
]'{
"task": {
"id": "5f208f564763e74744b2ba87"
}
}{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}{
"detail": "Header `X-BULK-OPERATION` should be provided for bulk operation."
}Response
Returns a Task Id of the asynchronous process.
