Changes

no edit summary
Line 33: Line 33:       −
[[Image:Configuration examples json-rpc terminal get id.png]]
+
[[Image:Configuration examples json-rpc terminal get id.png|961px|center]]
    
The picture above depicts the process of obtaining a Session ID. The ID itself is encapsulated in a blue rectangle. Copy this ID as you will need it to authenticate yourself when using other commands.
 
The picture above depicts the process of obtaining a Session ID. The ID itself is encapsulated in a blue rectangle. Copy this ID as you will need it to authenticate yourself when using other commands.
Line 47: Line 47:  
Highlighted in red is the Session ID. Replace it with the Session ID that was provided to you. Highlighted in orange is the command that we used for our query and highlighted in green is the parameter for the command: '''gsmctl -q'''.
 
Highlighted in red is the Session ID. Replace it with the Session ID that was provided to you. Highlighted in orange is the command that we used for our query and highlighted in green is the parameter for the command: '''gsmctl -q'''.
   −
The picture bellow is a visual representation of this example. Encapsulated in a blue rectangle is the answer to the ''gsmctl -q'' query: '''-69 dBm'''.  
+
The picture bellow is a visual representation of this example. Encapsulated in a blue rectangle is the answer to the ''gsmctl -q'' query: '''-73 dBm'''.  
      −
[[Image:Configuration examples json-rpc terminal gsmctl.png]]
+
[[Image:Configuration examples json-rpc terminal gsmctl.png|961px|center]]
    
You can issue almost any Linux command in a similar manner. For example, if you wish to get a list of file names contained in the config folder, the Linux command to do so would be '''ls /etc/config''', which, translated to JSON-RPC, would be:
 
You can issue almost any Linux command in a similar manner. For example, if you wish to get a list of file names contained in the config folder, the Linux command to do so would be '''ls /etc/config''', which, translated to JSON-RPC, would be:
Line 56: Line 56:  
  curl -d "{\"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"call\", \"params\": [\"a74c8e07646f0da2bfddce35bf3de1f3\", \"file\", \"exec\", {\"command\":\"<span style=color:orange>ls</span>\", \"params\": [\"<span style=color:orange>/etc/config</span>\"] } ] }" http://<span style=color:black>192.168.1.1</span>/ubus
 
  curl -d "{\"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"call\", \"params\": [\"a74c8e07646f0da2bfddce35bf3de1f3\", \"file\", \"exec\", {\"command\":\"<span style=color:orange>ls</span>\", \"params\": [\"<span style=color:orange>/etc/config</span>\"] } ] }" http://<span style=color:black>192.168.1.1</span>/ubus
   −
[[Image:Configuration examples json-rpc terminal ls.png]]
+
[[Image:Configuration examples json-rpc terminal ls.png|961px|center]]
    
The command is encapsulated in an orange rectangle and the answer - in a blue one.
 
The command is encapsulated in an orange rectangle and the answer - in a blue one.
Line 64: Line 64:  
This section will describe how to use '''uci set''' commands in order to set or change various router parameters via JSON-RPC. For more general information about the usage and syntax of UCI commands, check out our '''[[UCI command usage]]''' guide.
 
This section will describe how to use '''uci set''' commands in order to set or change various router parameters via JSON-RPC. For more general information about the usage and syntax of UCI commands, check out our '''[[UCI command usage]]''' guide.
   −
====uci set====
+
====UCI SET====
 
----
 
----
 
The ''uci set'' command is used to set router parameters. As an example, lets try to change the router's '''LAN IP address'''. The command to do so looks like this:
 
The ''uci set'' command is used to set router parameters. As an example, lets try to change the router's '''LAN IP address'''. The command to do so looks like this:
Line 73: Line 73:       −
[[Image:Configuration examples json-rpc terminal uci set.png]]
+
[[Image:Configuration examples json-rpc terminal uci set.png|961px|center]]
   −
====uci commit====
+
====UCI COMMIT====
 
----
 
----
 
In order to commit the changes from RAM to flash memory, you must execute a '''uci commit''' command. Continuing from the example above, lets commit the changes made to the ''network'' config. The command to do so looks like this:
 
In order to commit the changes from RAM to flash memory, you must execute a '''uci commit''' command. Continuing from the example above, lets commit the changes made to the ''network'' config. The command to do so looks like this:
Line 85: Line 85:  
'''{"jsonrpc":"2.0","id":1,"result":[0]}'''
 
'''{"jsonrpc":"2.0","id":1,"result":[0]}'''
   −
====luci-reload====
+
====LUCI-RELOAD====
 
----
 
----
 
In order for the changes to take effect, use the '''luci-reload''' command which restarts all of the router's services. The luci-reload command looks like this:
 
In order for the changes to take effect, use the '''luci-reload''' command which restarts all of the router's services. The luci-reload command looks like this:
Line 100: Line 100:     
The command above will '''enable''' the Ping Reboot function, set the host to ping to '''8.8.4.4''' and ping packet size to '''64'''. The default values are highlighted in orange and the new ones are highlighted in green.
 
The command above will '''enable''' the Ping Reboot function, set the host to ping to '''8.8.4.4''' and ping packet size to '''64'''. The default values are highlighted in orange and the new ones are highlighted in green.
 +
 +
'''Note: Remember always to use the commands in the order (set, commit, luci-reload)'''

Navigation menu