To create a new Device Group please make a POST request to the following URL:
HTTP Method URL POST https://industrial.api.ubidots.com/api/v2.0/device_groups/
Parameter Type Use Description token String Authentication Authentication Token can optionally be sent as a query parameter.
Parameter Type Required? Default Value Description label String Yes N/A (required) API label of Device Group name String No Same as label Name of Device Group organization <organization_key> No nullKey of Organization (Id or Label) tags String Array No []Device Group tags
Parameter Type Description X-Auth-Token String Authentication Token of accountContent-Type String (application/json) Content type of body
cURL (Request)
curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/device_groups/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"url": "http://industrial.api.ubidots.com/api/v2.0/device_groups/5e1c9f7789f9bd33017e05ef",
"id": "5e1c9f7789f9bd33017e05ef",
"label": "ellabelytales",
"name": "elGrupoYTales",
"organization": null,
"devices": "http://industrial.api.ubidots.com/api/v2.0/device_groups/5e1c9f7789f9bd33017e05ef/devices",
"tags": ["example-tag"]
}'
201 OK 400 Bad Request 401 Unauthorized
{
"url": "https://industrial.api.ubidots.com/api/v2.0/device_groups/5e1c9f7789f9bd33017e05ef",
"id": "5e1c9f7789f9bd33017e05ef",
"label": "ellabelytales",
"name": "elGrupoYTales",
"organization": {
"url": "https://industrial.api.ubidots.com/api/v2.0/organizations/876543211d847278b1baf2af",
"_deprecated_id": 987,
"id": "8765432171d847278b1baf2af",
"label": "my_org",
"name": "My org"
},
"devices": "https://industrial.api.ubidots.com/api/v2.0/device_groups/5e1c9f7789f9bd33017e05ef/devices",
"deviceFilter": {},
"createdAt": "2020-01-13T16:48:55.972853Z",
"tags": ["example-tag"]
}{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}
Returns an Device Group object of the Device Group created.