# Devices

Manage devices in your account using these endpoints.

# List devices

Lists all devices for a particular account.

GET  /devices?version=lite&page={page}&organization={org_id}

Example Request

$ curl --request GET 'https://console.radiobridge.com/api/visualization/v1/devices?version=lite&page=1&organization=2' \
--header 'organization: <organization id>' \
--header 'Authorization: Bearer <token>'

Example Response

{
    "data": [
        {
            "id": 1,
            "device_id": "TESTID2",
            "device_type_id": 16,
            "device_type_name": "RBS301-DWS - LoRa Door/Window",
            "device_name": "Water Sensor",
            "network_name": "Multitech - Radio Bridge account",
            "last_seen": "--",
            "region": null
        },
        {
            "id": 4,
            "device_id": "TESTING1",
            "device_type_id": 18,
            "device_type_name": "RBS301-CON - LoRa Contact Sensor",
            "device_name": "Ambient Light Sensor",
            "network_name": "Multitech - Radio Bridge account",
            "last_seen": "--",
            "region": null
        },
        {
            "id": 20,
            "device_id": "TESTID123",
            "device_type_id": 19,
            "device_type_name": "RBS301-WAT - LoRa Water Sensor",
            "device_name": "Single Push Button",
            "network_name": "Multitech - Radio Bridge account",
            "last_seen": "--",
            "region": null
        }
    ],
    "more": false
}

You can read detailed description for each attribute in the "Request/Response Parameters" table section.

# Retrieve Device by Device EUI

Retrieve a single device details by device EUI

GET  /devices/<deviceId>?version=lite

Example Request

$ curl --request GET 'https://console.radiobridge.com/api/visualization/v1/devices/TESTID2?version=lite' \
--header 'Organization: <organization id>' \
--header 'Authorization: Bearer <token>'

Example Response

{
    "data": {
        "id": 1,
        "device_id": "TESTID2",
        "device_type_id": 16,
        "device_type_name": "RBS301-DWS - LoRa Door/Window",
        "device_name": "Door Sensor",
        "network_name": "Multitech - Radio Bridge account",
        "last_seen": "2022-10-03 14:40:35",
        "region": null,
        "device_status": {
            "lastmsg_time": "Oct 03, 2022 14:40:35 (UTC)",
            "battery": "2.5",
            "tamper": "Yes",
            "tamper_detect_since_reset": "Yes",
            "config_error": "No",
            "rate_limit_status": "No",
            "current_sensor_state": "Open",
            "hardware_version": "1.0.2",
            "firmware_version": "1.0.2",
            "low_battery": "No"
        },
        "url": "https://console.radiobridge.com/devices/TESTID2",
        "groups": []
    }
}

You can read detailed description for each attribute in the "Request/Response Parameters" table section.

# Device Configurations

Retrieves the new device form configuration details based on the selected network, Response tells all about required fields, their type, any values for the dropdown fields etc.

GET  /configurations/?network={network}&type=device
Property Description
network (required) allowed options: machineq, senet, thethingsnetwork, loriot, multitech, chirpstack, kerlink, helium, aws_iot_core

Example Request

curl --request GET 'https://console.radiobridge.com/api/visualization/v1/configurations?network=thethingsnetwork&type=device' \
--header 'Organization: <organization id>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>'

Example Response

{
    "payment": {
        "eligible": false,
        "subscriptions": false,
        "isOnTrial": "Oct 03, 2023 09:07:20 (UTC)",
        "isDemoAccount": false,
        "remainingDevices": 97
    },
    "user_account_configured": false,
    "form": {
        "data": {
            "regions": [
                {
                    "name": "Europe 1",
                    "id": "eu1"
                }
            ],
            "gateways": [],
            "frequencyPlans": [
                {
                    "id": "EU_863_870_TTN",
                    "base_id": "EU_863_870",
                    "name": "Europe 863-870 MHz (SF9 for RX2 - recommended)",
                    "base_frequency": 868
                }
            ],
            "joinEui": [
                "0101010101010101",
                "7894E80000000000"
            ],
            "groups": []
        },
        "fields": {
            "consoleOnly": {
                "validation": "optional",
                "type": "select",
                "values": {
                    "1": "Yes",
                    "0": "No"
                }
            },
            "network": {
                "validation": "required",
                "type": "select",
                "values": {
                    "machineq": "MachineQ",
                    "multitech": "Multitech"
                }
            },
            "registerMethod": {
                "validation": "required",
                "type": "select",
                "values": {
                    "radiobridge": "Radio Bridge",
                    "user_account": "User Account"
                }
            },
            "deviceId": {
                "validation": "required",
                "type": "text"
            },
            "deviceName": {
                "validation": "required",
                "type": "text"
            },
            "deviceKey": {
                "validation": "required_if:consoleOnly,1",
                "type": "text"
            },
            "deviceTypeId": {
                "validation": "required",
                "type": "select",
                "values": {
                    "P05RBS302GB": "RBS302-GB - LoRa Glass Break",
                }
            },
            "joinEui": {
                "validation": "required",
                "type": "text",
                "values": [
                    "0101010101010101",
                    "7894E80000000000"
                ]
            },
            "gatewayId": "na",
            "appRegion": {
                "validation": "required",
                "type": "select",
                "values": {
                    "eu1": "Europe 1"
                }
            },
            "frequencyPlan": {
                "validation": "required",
                "type": "select",
                "values": {
                    "EU_863_870": "Europe 863-870 MHz (SF12 for RX2)"
                }
            },
            "mfatoken": "na",
            "groups": {
                "validation": "optional",
                "type": "multiselect",
                "values": []
            }
        }
    }
}
Parameter Type Description
payment object Payment object contains various fields to indicate if the network requires any subscription payment and the user is allowed to add the device.
user_account_configured boolean Indicated if user has configured their own account in Console under Integrations tab for the requested network.
form object Form configuration object holds the field details, where object key represents the field name and its attribute explains various requirements, e.g. validation, field type, values etc.

Payment object

Parameter Type Description
eligible boolean Indicates if the device registration through selected network requires any payment or its free to register.
subscriptions boolean Indicates if the user is subscribed to the pro membership
isOnTrial boolean or DateTime Holds the false if the user account is not on trial, Otherwise holds the Trial expiry date and time
isDemoAccount boolean Indicates if the user account is a demo account, Demo accounts are allowed the devices without any payment
remainingDevices integer This indicates the remaining device quota in the user account

# Batch Device Request

Create, update and delete devices in bulk

GET  /batch-device-requests
Property Required Description
Create
deviceName Yes Name of your device
deviceId Yes Hexadecimal value of length 16
network Yes Network name - allowed options: machineq, senet, thethingsnetwork, loriot, multitech, chirpstack, kerlink, helium, aws_iot_core
registerMethod Yes Value will always be radiobridge
deviceKey Yes Value of 32 characters
deviceTypeId Yes Device type id from device type list
appRegion Yes Allowed options: US915,EU868,AU915,AS923,CN470,EU433,KR920,RU864,CN779,IN865
frequencyPlan Yes Frequency plan
joinEui Yes Unique ID of 64 bit number
gatewayId Yes Id of your gateway that you want to add to the list of gateways
consoleOnly No True or false
action Yes create - to create the device
Update
deviceName Yes Name of the device
deviceId Yes Hexadecimal value of length 16
action Yes update - to update the device
Delete
deviceId Yes Hexadecimal value of length 16
action Yes delete - to delete the device

Example Request

curl --request POST 'https://console.radiobridge.com/api/visualization/v1/batch-device-requests' \
--header 'Accept: application/json' \
--header 'Organization: <organization id>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "devices": [
        {
            "deviceName": "Test New Device",
            "deviceId": "1234567890ABC567",
            "provisioningData": {
                "network": "loriot",
                "registerMethod": "radiobridge",
                "deviceKey": "1234567890ABCDEF1234567890ABCDEF",
                "deviceTypeId": 59,
                "gatewayId": 2,
                "joinEui": "0101010101010101",
                "appRegion": null,
                "frequencyPlan": "US_902_928_FSB_2",
                "consoleOnly": false
            },
            "action": "Create"
        },
        {
            "deviceName": "Updated Updated Device",
            "deviceId": "TESTID123",
            "groups": [],
            "action": "Update"
        },
        {
            "deviceId": "1234567890ABC567",
            "action": "Delete"
        }
    ]
}'

Example Response

{
    "data": [
        {
            "status": true,
            "message": "Device added successfully",
            "deviceId": "1234567890ABC577"
        },
        {
            "status": true,
            "message": "Device updated successfully",
            "deviceId": "TESTID123"
        },
        {
            "status": false,
            "message": "device not found",
            "deviceId": "1234567890ABC567"
        }
    ]
}
Parameter Type Description
status boolean Status will be true in case of success and false when it fails
message string Message
deviceId string hexadecimal value of length 16

Example Error

{
    "data": [
        {
            "status": false,
            "message": "Device registration failed due to the validation errors.",
            "errors": [
                "The Device EUI is required.",
                "The Device Name is required.",
                "The Device EUI field is required.",
                "The App Key is required.",
                "The Device Type is required.",
                "Please select a network to register the device.",
                "Please select a register method.",
                "The provisioning data.join eui field is required."
            ],
            "deviceId": null
        },
        {
            "status": false,
            "message": "device not found",
            "deviceId": null
        },
        {
            "status": false,
            "message": "device not found",
            "deviceId": null
        }
    ]
}