Changes

no edit summary
Line 13: Line 13:  
* One RUTxxx series router.<br>
 
* One RUTxxx series router.<br>
 
'''Configuration scheme:'''
 
'''Configuration scheme:'''
[[File:{{{file_scheme}}}|border|class=tlt-border|center]]
+
[[File:{{{file_scheme}}}|border|class=tlt-border]]
    
==Enabling JSON-RPC==
 
==Enabling JSON-RPC==
 
Before anything else, you'll need to make sure JSON-RPC is enabled on your router. JSON-RPC is enabled by default, so if you haven't made any changes to the router's access settings, everything should be in order. Otherwise you can check JSON-RPC status by logging into your router's WebUI and navigating to '''System → Administration → Access Control'''. Look for the ''WebUI'' section; there will be an '''Enable JSON RPC''' field. Make sure it is checked:
 
Before anything else, you'll need to make sure JSON-RPC is enabled on your router. JSON-RPC is enabled by default, so if you haven't made any changes to the router's access settings, everything should be in order. Otherwise you can check JSON-RPC status by logging into your router's WebUI and navigating to '''System → Administration → Access Control'''. Look for the ''WebUI'' section; there will be an '''Enable JSON RPC''' field. Make sure it is checked:
   −
[[File:WEBUI JSON.jpg|border|class=tlt-border|center]]
+
[[File:WEBUI JSON.jpg|border|class=tlt-border]]
    
==Using JSON-RPC (Linux)==
 
==Using JSON-RPC (Linux)==
Line 33: Line 33:       −
[[Image:Configuration examples json-rpc terminal get id.png|961px|center]]
+
[[Image:Configuration examples json-rpc terminal get id.png|961px]]
    
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 50: Line 50:       −
[[Image:Configuration examples json-rpc terminal gsmctl.png|961px|center]]
+
[[Image:Configuration examples json-rpc terminal gsmctl.png|961px]]
    
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|961px|center]]
+
[[Image:Configuration examples json-rpc terminal ls.png|961px]]
    
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 73: Line 73:       −
[[Image:Configuration examples json-rpc terminal uci set.png|961px|center]]
+
[[Image:Configuration examples json-rpc terminal uci set.png|961px]]
    
====UCI COMMIT====
 
====UCI COMMIT====

Navigation menu