Changes

no edit summary
Line 1: Line 1: −
==Summary==
+
<font size="+1">==Summary==
   −
<font size="+1">'''JSON-RPC''' is a remote procedure call protocol encoded in JSON. It is a very simple protocol (and very similar to XML-RPC), defining only a few data types and commands. JSON-RPC allows for notifications (data sent to the server that does not require a response) and for multiple calls to be sent to the server which may be answered out of order. This is guide on how to use JSON-RPC on RUT230, RUT240, RUT850, RUT950 and RUT955 routers.</font>
+
'''JSON-RPC''' is a remote procedure call protocol encoded in JSON. It is a very simple protocol (and very similar to XML-RPC), defining only a few data types and commands. JSON-RPC allows for notifications (data sent to the server that does not require a response) and for multiple calls to be sent to the server which may be answered out of order. This is guide on how to use JSON-RPC on RUT230, RUT240, RUT850, RUT950 and RUT955 routers.
    
==Login via JSON-RPC==
 
==Login via JSON-RPC==
   −
<font size="+1">To login to a RUT device via JSON-RPC, first make sure that monitoring via JSON-RPC is enabled on that device. To do so, follow the steps bellow:</font>
+
To login to a RUT device via JSON-RPC, first make sure that monitoring via JSON-RPC is enabled on that device. To do so, follow the steps bellow:
    
===Enabling JSON-RPC===
 
===Enabling JSON-RPC===
   −
[[Image:Blue bubble 1 1.png]]<font size="+1">Go the Administration section of the System tab: '''System->Administration'''</font>
+
<font size="+1">Go the Administration section of the System tab: '''System->Administration'''
      Line 17: Line 17:       −
[[Image:Blue bubble 1 2.png]]<font size="+1">Then go to the '''Access Control''' section:</font>
+
Then go to the '''Access Control''' section:
      Line 25: Line 25:       −
[[Image:Blue bubble 1 3.png]]<font size="+1">Under '''WebUI''', check the '''Enable JSON RPC''' field:</font>
+
Under '''WebUI''', check the '''Enable JSON RPC''' field:
      Line 34: Line 34:  
===Obtaining a session ID===
 
===Obtaining a session ID===
   −
<font size="+1">To login to the router via JSON-RPC you will need software capable of sending requests to the router. The simplest solution is to install an add-on similar to Firefox’s '''“Poster”''': '''https://addons.mozilla.org/en-US/firefox/addon/poster/'''.  
+
To login to the router via JSON-RPC you will need software capable of sending requests to the router. The simplest solution is to install an add-on similar to Firefox’s '''“Poster”''': '''https://addons.mozilla.org/en-US/firefox/addon/poster/'''.  
   −
Once you've installed this add-on, you can launch by opening the Mozilla Firefox browser and pressing '''Ctrl+Alt+p'''. </font>
+
Once you've installed this add-on, you can launch by opening the Mozilla Firefox browser and pressing '''Ctrl+Alt+p'''.  
      −
<font size="+1">If you're using '''Google Chrome''', you can get '''"Chrome Poster"''': '''https://chrome.google.com/webstore/detail/chrome-poster/cdjfedloinmbppobahmonnjigpmlajcd?hl=en'''.
+
If you're using '''Google Chrome''', you can get '''"Chrome Poster"''': '''https://chrome.google.com/webstore/detail/chrome-poster/cdjfedloinmbppobahmonnjigpmlajcd?hl=en'''.
   −
Once you've installed this add-on, a "P" shaped icon will appear in the top right corner of you browser's window:</font>
+
Once you've installed this add-on, a "P" shaped icon will appear in the top right corner of you browser's window:
      Line 47: Line 47:       −
<font size="+1">Click it to launch Chrome Poster.</font>
+
Click it to launch Chrome Poster.
   −
<font size="+1">The rest of this guide will focus on '''Firefox's Poster''', but all the steps bellow apply to '''Chrome Poster''' as well.</font>
+
The rest of this guide will focus on '''Firefox's Poster''', but all the steps bellow apply to '''Chrome Poster''' as well.
      −
<font size="+1">In order to obtain a Session ID, type in the router's LAN IP address in the '''URL''' field, type in the login username and password in the '''User Auth.''' field. Then paste this command into the '''Content to send''' field and click '''Post''':</font>
+
In order to obtain a Session ID, type in the router's LAN IP address in the '''URL''' field, type in the login username and password in the '''User Auth.''' field. Then paste this command into the '''Content to send''' field and click '''Post''':
   −
<b><font size="+1">{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "00000000000000000000000000000000", "session", "login", { "username": "root", "password": "<span style="color:orange">admin01</span>"  } ] }</font></b>
+
<b>{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "00000000000000000000000000000000", "session", "login", { "username": "root", "password": "<span style="color:orange">admin01</span>"  } ] }</b>
   −
<font size="+1">The section highlighted in orange is the router's admin password which by default is '''admin01'''. Replace this part with your router's password.</font>
+
The section highlighted in orange is the router's admin password which by default is '''admin01'''. Replace this part with your router's password.
    
[[Image:Configuration examples json-rpc firefox poster session id.PNG]]
 
[[Image:Configuration examples json-rpc firefox poster session id.PNG]]
Line 62: Line 62:       −
<font size="+1">Once you've issued the command, a Response window containing your Session ID should appear:</font>
+
Once you've issued the command, a Response window containing your Session ID should appear:
      Line 68: Line 68:       −
<font size="+1">Copy the ID since you'll be needing it when issuing other commands to the router.
+
Copy the ID since you'll be needing it when issuing other commands to the router.
   −
'''NOTE:''' if your commands stop working and you get a Response like this: '''{"jsonrpc":"2.0","id":1,"error":{"code":-32002,"message":"Access denied"}}''', it probably means your Session ID has expired and you need a new one. A Session ID expires after 300 seconds (5 minutes).</font>
+
'''NOTE:''' if your commands stop working and you get a Response like this: '''{"jsonrpc":"2.0","id":1,"error":{"code":-32002,"message":"Access denied"}}''', it probably means your Session ID has expired and you need a new one. A Session ID expires after 300 seconds (5 minutes).
    
===Getting router parameters===
 
===Getting router parameters===
   −
<font size="+1">Now that you have obtained a Session ID, you can issue commands to the router. Lets start with commands that return information about the router. For example, this is a command that returns the router's '''[[RSSI]]'''(signal strength) value:
+
Now that you have obtained a Session ID, you can issue commands to the router. Lets start with commands that return information about the router. For example, this is a command that returns the router's '''[[RSSI]]'''(signal strength) value:
    
{"jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "<span style="color:red">bde01a2da4a6f4a515bb9466f90bc58a</span>", "file", "exec", { "command": "<span style="color:orange">gsmctl</span>", "params":["<span style="color:orange">-q</span>"] } ] }"
 
{"jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "<span style="color:red">bde01a2da4a6f4a515bb9466f90bc58a</span>", "file", "exec", { "command": "<span style="color:orange">gsmctl</span>", "params":["<span style="color:orange">-q</span>"] } ] }"

Navigation menu