Skip to main content

Downlink — get the LoRaWAN class of a device

Returns the LoRaWAN class of a device: A, B or C. The class determines when the server can deliver a downlink: to a class A device only right after its next uplink, to a class C device at any time. Request the class before sending data to know how long delivery may take.

Request and response: dev_lw_class_req → get_devices_resp.
Access: a low access level token sees the devices of its application and of applications that granted it access; a high access level token sees all devices of the owner.

Current ONS version

The server responds with get_devices_resp, not dev_lw_class_resp as stated in the v0.17 description. You can tell this response from the response to get_devices_req by the lwClass field and your operation_id.

The server returns at most one device per request, so always specify devEui.

Request​

Fields not marked as required may be omitted.

FieldTypeDescription
cmdstringdev_lw_class_req
operation_idstringAny string; the server returns it in the response to match the request and the response
devEuistringDevice DevEUI, 16 hex characters. Without it the server returns one of the available devices — see "Current ONS version"
{
"cmd": "dev_lw_class_req",
"operation_id": "axd",
"devEui": "6F1E570FFE14DBFC"
}

Response​

FieldTypeDescription
cmdstringget_devices_resp
operation_idstringValue from the request
statusuint81 — success, 2 — error
deviceCountuint32Number of devices in the list: 0 or 1
deviceListarrayDevices: devEui, devAddr and lwClass — LoRaWAN class (1 — A, 2 — B, 3 — C)
error_code, error_textuint8, stringOnly on error, see below
{
"cmd": "get_devices_resp",
"operation_id": "axd",
"status": 1,
"deviceCount": 1,
"deviceList": [
{
"devEui": "6F1E570FFE14DBFC",
"devAddr": "78130AE1",
"lwClass": 1
}
]
}

Errors​

error_codeWhat happened
3Invalid data in the request, e.g. devEui is not 16 hex characters
0Internal server error — retry later

A device that does not exist or is not available with your token is not treated as an error: it is simply absent from deviceList.

See also​