Delete device
Deletes a device of the owner by DevEUI or DevAddr. The device is marked as deleted: get_devices_req and update_device_req no longer find it, and its DevEUI and DevAddr can be taken by a new device.
Request and response: delete_device_req → delete_device_resp.
Access: high access level token only; any device of the owner can be deleted. With a low access level token the server responds with error 1.
Current ONS version
The request schema in the v0.17 description names the command delete_device, but the server accepts only delete_device_req, as in the example.
Request
Fields not marked as required may be omitted.
| Field | Type | Description |
|---|---|---|
cmd | string | delete_device_req |
operation_id | string | Any string; the server returns it in the response to match the request and the response |
devEui | string | devEui or devAddr is required. Device DevEUI, 16 hex characters in upper case — the server compares case-sensitively |
devAddr | string | devEui or devAddr is required. Device DevAddr, 8 hex characters in upper case. If both fields are given, both must match |
{
"cmd": "delete_device_req",
"operation_id": "rdk",
"devEui": "7DA50BE8C74CE6DC"
}
Response
| Field | Type | Description |
|---|---|---|
cmd | string | delete_device_resp |
operation_id | string | Value from the request |
status | uint8 | 1 — the device is deleted, 2 — error |
error_code, error_text | uint8, string | Only on error, see below |
{
"cmd": "delete_device_resp",
"operation_id": "rdk",
"status": 1
}
Errors
error_code | error_text | What happened |
|---|---|---|
| 1 | Unauthorized access | The request came with a low access level token |
| 2 | Required field is not filled | Neither devEui nor devAddr is given |
| 3 | Node does not exists | The device is not found: the owner has no such device, it is already deleted, its application is deleted, or the DevEUI was passed in lower case |
Good to know
- Retrying is safe. The server responds to a repeated request with error 3: the device is already deleted.
- The network server is not told about the deletion. It may keep serving a device that is currently on the air, using the settings from its memory.
See also
create_device_req— register the device again.delete_application_req— delete the application's devices before deleting the application.