Changes

Line 229: Line 229:  
==Using JSON-RPC with Linux OS==
 
==Using JSON-RPC with Linux OS==
   −
This section will describe how to use JSON-RPC commands with a Linux OS system. The guide for Windows users can be found '''[[Monitoring_via_JSON-RPC#Using_JSON-RPC_with_Windows_OS|here]]'''
+
This section describes how to use JSON-RPC commands with a Linux OS system. To find the guide for Windows users, jump to this section: '''[[Monitoring_via_JSON-RPC#Using_JSON-RPC_with_Windows_OS|JSON-RPC on Widnows]]'''
    
===Obtaining a session ID===
 
===Obtaining a session ID===
 
----
 
----
To login to the router via JSON-RPC you must first obtain a Session ID. To do so, you must send an '''HTTP POST''' request to the router. Open the Linux '''Terminal''' app and execute this command:
+
To log in to the router via JSON-RPC you must first obtain a Session ID. To do so, you must send an '''HTTP POST''' request to the router. Open the Linux '''Terminal''' app and execute this command:
    
  curl -d "{ \"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"call\", \"params\": [ \"00000000000000000000000000000000\", \"session\", \"login\", { \"username\": \"root\", \"password\": \"<span style=color:orange>admin01</span>\"  } ] }" http://<span style=color:green>192.168.1.1</span>/ubus   
 
  curl -d "{ \"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"call\", \"params\": [ \"00000000000000000000000000000000\", \"session\", \"login\", { \"username\": \"root\", \"password\": \"<span style=color:orange>admin01</span>\"  } ] }" http://<span style=color:green>192.168.1.1</span>/ubus   
   −
The section highlighted in orange is the router's admin password. admin01 is the default value, replace it with your router's password. The address highlighted in green is the router's IP address. Replace this value with your router's IP. If you're trying to reach the router from '''[[LAN]]''', use the local IP address (default: '''192.168.1.1'''), if you're trying to reach the router from '''[[WAN]]''', use the router's WAN IP address.
+
The section highlighted in orange is the router's admin password. admin01 is the default value, replace it with your router's password. The address highlighted in green is the router's IP address. Replace this value with your router's IP. If you're trying to reach the router from '''[[LAN]]''', use the local IP address (default: 192.168.1.1), if you're trying to reach the router from '''[[WAN]]''', use the router's WAN IP address.
      Line 249: Line 249:     
  curl -d "{ \"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"call\", \"params\": [\"<span style=color:red>a74c8e07646f0da2bfddce35bf3de1f3</span>\", \"file\", \"exec\", { \"command\":\"<span style=color:orange>gsmctl</span>\", \"params\": [\"<span style=color:green>-q</span>\"] } ] }" http://<span style=color:black>192.168.1.1</span>/ubus
 
  curl -d "{ \"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"call\", \"params\": [\"<span style=color:red>a74c8e07646f0da2bfddce35bf3de1f3</span>\", \"file\", \"exec\", { \"command\":\"<span style=color:orange>gsmctl</span>\", \"params\": [\"<span style=color:green>-q</span>\"] } ] }" http://<span style=color:black>192.168.1.1</span>/ubus
Highlighted in red is the '''Session ID'''. Replace this with your own Session ID. Highlighted in orange is the command that we used and highlighted in green is the parameter for the command - '''gsmctl -q'''. Shortly put, you can replace the Session ID, command and parameter with your needed values.  
+
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 visual representation of this example. Encapsulated in a blue rectangle is the answer to the gsmctl -q query: -73 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'''.  
      Line 262: Line 262:  
[[Image:Configuration examples json-rpc terminal ls.png]]
 
[[Image:Configuration examples json-rpc terminal ls.png]]
   −
The command is encapsulated in an orange rectangle and the answer in blue.
+
The command is encapsulated in an orange rectangle and the answer - in a blue one.
    
===Setting router parameters===
 
===Setting router parameters===
 
----
 
----
This section will describe how to use '''uci set''' commands via JSON-RPC
+
This section will describe how to use '''uci set''' commands via JSON-RPC.
    
====uci set====
 
====uci set====