This endpoints assigns one or more devices to a specific Device Group.
Request
To assign one or more Devices to a Device Group please make a POST request to the following URL:
HTTP Method | URL |
---|---|
POST |
|
Path Parameters
Parameter | Type | Description |
---|---|---|
device_group_key | String | The id or label of the Device Group, label should use the prefix |
Query Parameters
Parameter | Type | Use | Description |
---|---|---|---|
token | String | Authentication | Authentication Token can optionally be sent as a query parameter. |
clear | Boolean | Assigning Modus | If |
Header
Parameter | Required? | Description |
---|---|---|
X-Auth-Header | Yes | Authentication Token of account |
$ curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/device_groups/<device_group_key>/_/assign_devices/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '[
"5e1cc1e789f9bd33017e05f4",
"~test",
{"id": "5e1cc1e789f9bd33babababa"}
]'
{
"count": 2,
"next": null,
"previous": null,
"results":[
{
"url": "https://industrial.api.ubidots.com/api/v2.0/devices/5e1cc1e789f9bd33017e05f4",
"id": "5e1cc1e789f9bd33017e05f4",
"label": "truck-v2",
"name": "Truck v2"
},
{
"url": "https://industrial.api.ubidots.com/api/v2.0/devices/5e1c8d9789f9bd33017e05e5",
"id": "5e1c8d9789f9bd33017e05e5",
"label": "test",
"name": "test"
},
{
"url": "https://industrial.api.ubidots.com/api/v2.0/devices/5e1c8d9789f9bd33017e05e5",
"id": "5e1cc1e789f9bd33babababa",
"label": "test2",
"name": "test2"
}
]
}
{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}
{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}
Response
Returns an Object with a results
array containing the devices assigned to the device group.