RPC Commands
ThingsBoard executes LwM2M operations on devices via RPC commands. Send them from the REST API, a dashboard widget, or the RPC Debug Terminal. For a full explanation of the RPC model, see Command & Control.
Command Structure
Section titled “Command Structure”Every LwM2M RPC command has two fields:
{ "method": "Read", "params": {"id": "/3/0/9"}}| Field | Description |
|---|---|
method | LwM2M operation name (see table below) |
params | Target resource and additional options |
Targeting Resources
Section titled “Targeting Resources”Use either the resource path or a key defined in the device profile:
| Format | Example |
|---|---|
| Resource path | {"id": "/3/0/9"} |
| Path with object version | {"id": "/3_1.2/0/9"} |
| Key | {"key": "batteryLevel"} |
In the RPC Debug Terminal omit the JSON wrapper — write Read {"id":"/3/0/9"} directly.
Supported Operations
Section titled “Supported Operations”| Method | Interface | Description |
|---|---|---|
Read | Device Management | Read a resource, instance, or all object instances |
Discover | Device Management | List available resources on an object or instance |
WriteUpdate | Device Management | Partial update — change specified resources, leave others |
WriteReplace | Device Management | Replace resource value(s) entirely |
WriteAttributes | Device Management | Set NOTIFICATION-class attributes (pmin, pmax, gt, lt, st) |
ReadComposite | Device Management | Read multiple resources across different objects at once |
WriteComposite | Device Management | Write multiple resources across different objects atomically |
Execute | Device Management | Trigger an action (e.g., reboot, firmware install) |
Delete | Device Management | Delete an Object Instance |
Observe | Information Reporting | Start observing a resource for changes |
ObserveCancel | Information Reporting | Cancel a single observation |
ObserveCancelAll | Information Reporting | Cancel all observations on the device (ThingsBoard-specific) |
ObserveReadAll | Information Reporting | List all active observations (ThingsBoard-specific) |
ObserveComposite | Information Reporting | Observe multiple resources in a single request |
ObserveCompositeCancel | Information Reporting | Cancel a composite observation |
DiscoverAll | ThingsBoard-specific | Return the full object/resource hierarchy of the client |
Read the current value of a resource, instance, or all object instances.
{"method": "Read", "params": {"id": "/3/0/9"}}# Terminal request:Read {"id":"/3/0/9"}
# Response:{"result":"CONTENT","value":"LwM2mSingleResource [id=9, value=100, type=INTEGER]"}Read by key:
Read {"key":"batteryLevel"}Read an entire object instance:
Read {"id":"/3/0"}Discover
Section titled “Discover”List the resources instantiated on an object or instance, returned as CoRE Link format.
{"method": "Discover", "params": {"id": "/3"}}# Terminal:Discover {"id":"/3"}
# Response:{"result":"CONTENT","value":"</3>,</3/0/0>,</3/0/1>,</3/0/2>,..."}WriteUpdate
Section titled “WriteUpdate”Partially update resource values — unspecified resources are not changed.
{"method": "WriteUpdate", "params": {"id": "/3/0", "value": {"14": "+5", "15": "Europe/Kyiv"}}}WriteUpdate {"id":"/3/0","value":{"14":"+5","15":"Europe/Kyiv"}}# Response: {"result":"CHANGED"}WriteReplace
Section titled “WriteReplace”Replace a resource value entirely.
{"method": "WriteReplace", "params": {"id": "/19/0/0", "value": "0081"}}WriteReplace {"id": "/19/0/0", "value": "0081"}# Response: {"result":"CHANGED"}WriteAttributes
Section titled “WriteAttributes”Set NOTIFICATION-class attributes on a resource (pmin, pmax, gt, lt, st). See Data Model for attribute descriptions.
{"method": "WriteAttributes", "params": {"id": "/19/0/0", "attributes": {"pmax": 120, "pmin": 10}}}WriteAttributes {"id":"/19/0/0","attributes":{"pmax":120,"pmin":10}}# Response: {"result":"CHANGED"}ReadComposite
Section titled “ReadComposite”Read any combination of resources, instances, or objects in a single request. Non-atomic — resources without a valid value are omitted from the response.
{"method": "ReadComposite", "params": {"ids": ["/3/0/9", "/1_1.2"]}}ReadComposite {"ids":["/3/0/9","/1_1.2"]}# Response: {"result":"CONTENT","value":"{/3/0/9=LwM2mSingleResource [id=9, value=75, type=INTEGER], ...}"}Read by keys:
ReadComposite {"keys":["batteryLevel","updateResult","pkgversion"]}WriteComposite
Section titled “WriteComposite”Write multiple resources across different objects atomically. All resources must be writable — the operation fails if any single write would fail.
{"method": "WriteComposite", "params": {"nodes": {"/19_1.1/0": {"0": {"0": "00ad45675600"}}, "/3_1.0/0/15": "Europe/Kyiv"}}}WriteComposite {"nodes":{"/19_1.1/0":{"0":{"0":"00ad45675600"}},"UtfOffset":"+04","/3_1.0/0/15":"Europe/Kyiv"}}# Response: {"result":"CHANGED"}Execute
Section titled “Execute”Trigger an action on the device. Can only target individual executable resources.
{"method": "Execute", "params": {"id": "/3/0/4"}}Execute {"id":"/3/0/4"}# Response: {"result":"CHANGED"}Common execute targets:
| Path | Action |
|---|---|
/3/0/4 | Reboot device |
/5/0/2 | Trigger firmware update install |
/1/0/8 | Registration Update Trigger |
/1/0/9 | Bootstrap-Request Trigger |
Delete
Section titled “Delete”Delete an Object Instance. The mandatory Device Object (ID 3) cannot be deleted.
{"method": "Delete", "params": {"id": "/19/1"}}Delete {"id":"/19/1"}# Response: {"result":"DELETE"}Observe
Section titled “Observe”Subscribe to changes on a resource, instance, or object. ThingsBoard receives a notification each time the value changes.
{"method": "Observe", "params": {"id": "/3/0/9"}}Observe {"id":"/3/0/9"}# Response: {"result":"CONTENT","value":"LwM2mSingleResource [id=9, value=28, type=INTEGER]"}ObserveCancel
Section titled “ObserveCancel”End a specific observation relationship.
{"method": "ObserveCancel", "params": {"id": "/5/0/7"}}ObserveCancel {"id":"/5/0/7"}# Response: {"result":"CONTENT","value":"1"}ObserveComposite
Section titled “ObserveComposite”Observe multiple resources across different objects in a single request.
{"method": "ObserveComposite", "params": {"ids": ["/5/0/7", "/5/0/5", "/3/0/9"]}}ObserveComposite {"ids":["/5/0/7","/5/0/5","/3/0/9"]}# Response: {"result":"CONTENT","value":"{/5/0/7=..., /5/0/5=..., /3/0/9=...}"}ObserveCompositeCancel
Section titled “ObserveCompositeCancel”Cancel a previously established composite observation.
{"method": "ObserveCompositeCancel", "params": {"ids": ["/5/0/7", "/5/0/5", "/3/0/9"]}}ObserveCompositeCancel {"ids":["/5/0/7","/5/0/5","/3/0/9"]}# Response: {"result":"CONTENT","value":"1"}ObserveCancelAll
Section titled “ObserveCancelAll”ThingsBoard-specific. Cancel all observations on the device at once. Use before switching observe strategies.
{"method": "ObserveCancelAll", "params": {}}ObserveCancelAll# Response: {"result":"CONTENT","value":"8"} // 8 observations cancelledObserveReadAll
Section titled “ObserveReadAll”ThingsBoard-specific. Return a list of all currently active observations on the device.
{"method": "ObserveReadAll", "params": {}}ObserveReadAll# Response: {"result":"CONTENT","value":"[\"/5/0/7\",\"/3/0/3\",\"/5/0/3\",\"/5/0/5\"]"}DiscoverAll
Section titled “DiscoverAll”ThingsBoard-specific. Return the full object and resource hierarchy of the connected client, built from the registration message. Does not send any request to the device — useful for troubleshooting and verifying object versions.
{"method": "DiscoverAll", "params": {}}DiscoverAll# Response: {"result":"CONTENT","value":"[{\"url\":\"/\",\"attributes\":{\"ct\":\"110\",\"rt\":\"\\\"oma.lwm2m\\\"\"}},{\"url\":\"/1\",\"attributes\":{\"ver\":\"1.1\"}},...]"}