Built-in GET/SET RPC Methods
Built-in GET/SET RPC methods let you read and write telemetry and attribute values on connected devices without any additional connector configuration. The method name and parameter string are sent as the RPC payload from the ThingsBoard RPC debug terminal on the gateway dashboard.
The following connectors support built-in GET/SET RPC methods:
Every telemetry and attribute parameter has GET and SET methods automatically, based on
the path defined in the connector configuration.
For example, given a timeseries entry:
{ "timeseries": [ { "key": "temperature", "path": "${ns=3;i=1001}" } ]}Read the current value of a node by its OPC-UA node ID:
get ns=3;i=1001;Response:
{"result": 25.34}Write a numeric value to a node:
set ns=3;i=1001; 23Write a string value to an attribute node (e.g. set model to T3000):
set ns=3;i=1008; T3000;Response:
{"success": "true", "code": 200}Read the value of a Modbus slave register:
get type=<type>;functionCode=<functionCode>;objectsCount=<objectsCount>;address=<address>;| Parameter | Description |
|---|---|
type | Data type of the value to read |
functionCode | Modbus function code |
objectsCount | Number of objects to read |
address | Register address |
Example — read a 16-bit integer from register 1 (outdoor temperature):
get type=16int;functionCode=3;objectsCount=1;address=1;Response:
{"result": {"value": 13}}Write a value to a Modbus slave register:
set type=<type>;functionCode=<functionCode>;objectsCount=<objectsCount>;address=<address>;value=<value>;| Parameter | Description |
|---|---|
type | Data type of the value to write |
functionCode | Modbus function code |
objectsCount | Number of objects to write |
address | Register address |
value | Value to write |
Example — write 80 to register 2 (room light level):
set type=16int;functionCode=6;objectsCount=1;address=2;value=80;Response:
{"result": {"value": "80"}}Verify by reading the register back:
get type=16int;functionCode=3;objectsCount=1;address=2;Response:
{"result": {"value": 80}}Subscribe to a response topic and publish a request to read a value:
get requestTopicExpression=<requestTopic>;responseTopicExpression=<responseTopic>;value=<value>;| Parameter | Description |
|---|---|
requestTopicExpression | Topic to publish the request to |
responseTopicExpression | Topic to subscribe to for the response |
value | Value to send with the request |
Example — read room light level from data/light_level, receiving the response on data/response:
get requestTopicExpression=data/get_light_level;responseTopicExpression=data/response;value=${params};Publish a message to an MQTT topic:
set requestTopicExpression=<requestTopic>;value=<value>;| Parameter | Description |
|---|---|
requestTopicExpression | Topic to publish the value to |
value | Value to send |
Example — set room light level to 80:
set requestTopicExpression=data/set_light_level;value=80;Verify by sending a GET request:
get requestTopicExpression=data/get_light_level;responseTopicExpression=data/response;value=${params};Read a property value from a BACnet device:
get objectType=<objectType>;objectId=<objectId>;propertyId=<propertyId>;| Parameter | Description |
|---|---|
objectType | BACnet object type |
objectId | BACnet object ID |
propertyId | BACnet property ID |
Example — read the current room light level (analogValue, object 1, presentValue):
get objectType=analogValue;objectId=1;propertyId=presentValue;Response:
{"result": "30.5"}Write a property value to a BACnet device:
set objectType=<objectType>;objectId=<objectId>;propertyId=<propertyId>;priority=<priority>;value=<value>;| Parameter | Description |
|---|---|
objectType | BACnet object type |
objectId | BACnet object ID |
propertyId | BACnet property ID |
priority | Write priority (optional, integer 1–16) |
value | Value to write (optional) |
At least one of value or priority must be provided. If value is omitted, the connector
sends a relinquish command with a Null value.
Example — set the room light level to 30.9:
set objectType=analogValue;objectId=1;propertyId=presentValue;value=30.9;Response:
{"result": "{\"status\":\"ok\"}"}Verify with GET:
get objectType=analogValue;objectId=1;propertyId=presentValue;Response:
{"result": "30.9"}Send a GET request to a REST endpoint:
get requestUrlExpression=<url>;value=<value>;| Parameter | Description |
|---|---|
requestUrlExpression | REST endpoint URL |
value | Value to include in the request |
Example — read the room light level from http://127.0.0.1:8000/light-level:
get requestUrlExpression=http://127.0.0.1:8000/light-level;value=${params};Response:
{"result": {"light-level": 30}}Send a POST (or other HTTP method) request to a REST endpoint:
set requestUrlExpression=<url>;value=<value>;HTTPMethod=<method>;| Parameter | Description |
|---|---|
requestUrlExpression | REST endpoint URL |
value | Value to send in the request body |
HTTPMethod | HTTP method to use (e.g. POST, PUT) |
Example — set the room light level to 80:
set requestUrlExpression=http://127.0.0.1:8000/light-level;value=80;HTTPMethod=POST;Response:
{"result": {"status": "ok"}}Verify with GET:
get requestUrlExpression=http://127.0.0.1:8000/light-level;value=${params};Response:
{"result": {"light-level": 80}}Send a GET request to an external API endpoint configured in the connector:
get requestUrlExpression=<path>;| Parameter | Description |
|---|---|
requestUrlExpression | Path or URL of the external API endpoint |
Example — read the room light level from the configured base URL:
get requestUrlExpression=light-level;Response:
{"result": "{\"light-level\":30}"}Send a POST (or other HTTP method) request to an external API endpoint:
set requestUrlExpression=<path>;value=<value>;httpMethod=<method>;| Parameter | Description |
|---|---|
requestUrlExpression | Path or URL of the external API endpoint |
value | Value to send |
httpMethod | HTTP method to use (e.g. POST, PUT) |
Example — set the room light level to 80:
set requestUrlExpression=light-level;value=80;httpMethod=POST;Response:
{"result": "{\"status\":\"ok\"}"}Verify with GET:
get requestUrlExpression=light-level;Response:
{"result": {"light-level": 80}}Read a file from the FTP server:
get filePath=<filePath>;| Parameter | Description |
|---|---|
filePath | Path to the file on the FTP server |
Example — read light_level.txt:
get filePath=./light_level.txt;Response:
{"result": 30}Write a value to a file on the FTP server:
set filePath=<filePath>;value=<value>;| Parameter | Description |
|---|---|
filePath | Path to the file on the FTP server |
value | Value to write |
Example — update light_level.txt to 80:
set filePath=./light_level.txt;value=80;Response:
{"result": "{\"success\": true}"}Verify with GET:
get filePath=./light_level.txt;Response:
{"result": 80}The Socket connector supports only the SET method — sending data to a TCP socket endpoint.
Send data to a TCP socket:
set address=<address>;port=<port>;value=<value>;| Parameter | Description |
|---|---|
address | IP address of the socket target |
port | TCP port of the socket target |
value | Value to send |
Example — send a light level of 80 to a sensor listening on 192.168.0.200:50003:
set address=192.168.0.200;port=50003;value=80;Response:
{"result": "ok"}