# Groups
Device groups allows the user to group the sensors in an account to batch them and create notifications or filter based on Groups. Group supports parent child relationship.
# List Groups
Lists all groups with hierarchy.
GET /device-groups
Example request
$ curl https://console.radiobridge.com/api/visualization/v1/device-groups
Example response
{
"data": [
{
"id": 180,
"groupName": "Test Group",
"parent_id": null,
"opened": true,
"devices": [
{
"id": 29,
"deviceId": "413D0E",
"userId": 1,
"deviceName": "Test Device",
"deviceTypeId": 40,
"plan_id": null,
"created_at": "2018-04-11T22:18:28.000000Z",
"updated_at": "2019-05-30T14:19:23.000000Z",
"deviceKey": "A2C3BF5F3F1D2A7E",
"deviceNetwork": 1,
"subscription_id": null,
"networkRegisterId": null,
"extra_notes": null,
"device_register_status": "active",
"api_job_id": "5af1c501c55ce636a0f116c9",
"api_error_json": "Devices with id [413D0E] are already registered in your group. If you want to change their device type association, use the transfer function",
"deleted_at": null,
"device_gateway": "sigfox",
"gateway_id": null,
"device_status": "Inactive",
"device_status_desc": null,
"device_no_longer_reporting": 0,
"added_at": "2019-05-30T14:19:23.000000Z",
"pivot": {
"groupId": 180,
"deviceId": 29
}
},
{
"id": 86,
"deviceId": "3DE971",
"userId": 1,
"deviceName": "Contact Sensor",
"deviceTypeId": 4,
"plan_id": null,
"created_at": "2018-04-28T12:30:30.000000Z",
"updated_at": "2018-05-22T02:16:49.000000Z",
"deviceKey": "0XFF",
"deviceNetwork": 1,
"subscription_id": null,
"networkRegisterId": null,
"extra_notes": "Performance improvement and some fixes",
"device_register_status": "register_error",
"api_job_id": "5af1c50580bd564edfdf4254",
"api_error_json": " Invalid PAC code: 0XFF (please contact your device supplier to obtain this code)",
"deleted_at": null,
"device_gateway": "sigfox",
"gateway_id": null,
"device_status": "Inactive",
"device_status_desc": null,
"device_no_longer_reporting": 0,
"added_at": "2018-05-22T02:16:49.000000Z",
"pivot": {
"groupId": 180,
"deviceId": 86
}
},
{
"id": 87,
"deviceId": "3DE972",
"userId": 1,
"deviceName": "Glass Break",
"deviceTypeId": 1,
"plan_id": null,
"created_at": "2018-04-28T12:31:05.000000Z",
"updated_at": "2018-05-10T21:30:42.000000Z",
"deviceKey": "0XFF",
"deviceNetwork": 1,
"subscription_id": null,
"networkRegisterId": null,
"extra_notes": null,
"device_register_status": "register_error",
"api_job_id": "5af1c505c55ce636a0f116d4",
"api_error_json": " Invalid PAC code: 0XFF (please contact your device supplier to obtain this code)",
"deleted_at": null,
"device_gateway": "sigfox",
"gateway_id": null,
"device_status": "Inactive",
"device_status_desc": null,
"device_no_longer_reporting": 0,
"added_at": "2018-05-10T21:30:42.000000Z",
"pivot": {
"groupId": 180,
"deviceId": 87
}
}
],
"children": []
}
]
}
# Create Group
Creates a new group.
POST /device-groups
Example request
curl --location --request POST 'https://console.radiobridge.com/api/visualization/v1/device-groups' \
--header 'Organization: 1' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"groupName":"New Group",
"selectedDevices":[87],
"selectedGroup":180
}'
Example request body
{
"groupName":"New Group",
"selectedDevices":[87],
"selectedGroup":180
}
Example response
{
"data": {
"id": 182,
"userId": 1,
"parent_id": 180,
"depth": 1,
"groupName": "New Group",
"groupConfig": "[]",
"created_at": "2021-12-24T20:32:26.000000Z",
"updated_at": "2021-12-24T20:32:26.000000Z",
"devices": [
{
"id": 87,
"deviceName": "Glass Break",
"pivot": {
"groupId": 182,
"deviceId": 87
}
}
]
}
}
# Retrieve Group
Retrieve information about a single Group.
GET /device-groups/{group_id}
Example request
curl https://console.radiobridge.com/api/visualization/v1/device-groups/{group_id}
Example response
{
"data": [
{
"id": 180,
"groupName": "Test Group",
"parent_id": null,
"opened": true,
"devices": [
{
"id": 29,
"deviceId": "413D0E",
"userId": 1,
"deviceName": "Test Device",
"deviceTypeId": 40,
"plan_id": null,
"created_at": "2018-04-11T22:18:28.000000Z",
"updated_at": "2019-05-30T14:19:23.000000Z",
"deviceKey": "A2C3BF5F3F1D2A7E",
"deviceNetwork": 1,
"subscription_id": null,
"networkRegisterId": null,
"extra_notes": null,
"device_register_status": "active",
"api_job_id": "5af1c501c55ce636a0f116c9",
"api_error_json": "Devices with id [413D0E] are already registered in your group. If you want to change their device type association, use the transfer function",
"deleted_at": null,
"device_gateway": "sigfox",
"gateway_id": null,
"device_status": "Inactive",
"device_status_desc": null,
"device_no_longer_reporting": 0,
"added_at": "2019-05-30T14:19:23.000000Z",
"pivot": {
"groupId": 180,
"deviceId": 29
}
}
]
}
]
}
# Update Group
Updates the group details and attach or remove devices to it.
Property | Description |
---|---|
groupName | (required) the name of the group |
selectedDevices | (optional) List of all device ids to attach to the group |
selectedDevices | (optional) Parent group id |
PATCH /device-groups/{group_id}
Example request
curl --location --request PATCH 'https://console.radiobridge.com/api/visualization/v1/device-groups/{group_id}' \
--header 'Organization: <organization id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"groupName":"Test Group",
"selectedDevices":[29,86,87],
"selectedGroup":null
}'
Example request body
{
"groupName":"Test Group",
"selectedDevices":[29,86,87],
"selectedGroup":null
}
Example response
{
"status": "success",
"status_code": 200,
"message": "Group updated successfully",
"data": {
"id": 180,
"userId": 1,
"parent_id": null,
"depth": 0,
"groupName": "Test Group",
"groupConfig": "[]",
"created_at": "2021-12-21T15:54:14.000000Z",
"updated_at": "2021-12-24T20:28:03.000000Z",
"devices": [
{
"id": 29,
"deviceName": "Test Device",
"pivot": {
"groupId": 180,
"deviceId": 29
}
},
{
"id": 86,
"deviceName": "Contact Sensor",
"pivot": {
"groupId": 180,
"deviceId": 86
}
},
{
"id": 87,
"deviceName": "Glass Break",
"pivot": {
"groupId": 180,
"deviceId": 87
}
}
]
}
}
# Delete Group
Delete a group from the account, This action will not remove actual devices.
DELETE /device-groups/{group_id}
Example request
curl --location --request DELETE 'https://console.radiobridge.com/api/visualization/v1/device-groups/{group_id}' \
--header 'Organization: <organization id>' \
--header 'Authorization: Bearer <token>'
Example response
HTTP 204