This is an old revision of the document!
CoovaChilli JSON Interface
Introduction
If CoovaChilli is compiled with JSON support it exposes a JSON interface on the controller.
This document will discuss the technical workings of the JSON interface.
In order to have access to the JSON interface you have to be on the same network served by CoovaChilli, this means you have to be connected to the hotspot in plain english.
Accessing the JSON interface
The JSON interface is served from the UAMLISTEN IP Address which is typically 10.1.0.1
It has a standard interface (HTTP) on UAMPORT which is typicallly 3990
If Coova is configured to also support HTTPS in the UAM, the HTTPS access will be on the UAMUIPORT which is typically port 4990.
Each of the endpoints can then be reached by appending /json/ and the end point name .
For HTTP a typical
URL will look like this
For HTTPS a typical
URL will look like this
Specifying a Callback
In order to allow cross site functionality the JSON interface also allows for you to include a value for the callback
Simply include callback and the required value for it in the query string of the endpoint call.
-
The reply will then be wrapped inside the value of callback
jQuery33105641008201093548_1612410177983({"versio......28-D2-44-20-04-8D"}})
The JSON interface methods
We will now unpack each of these endpoints in their own dedicated session
status
{
"version":"1.0",
"clientState":0,
"nasid":"ZA-VM1",
"challenge":"0caeb2c0240fca8f430ea54e6423151e",
"location":{"name":"My HotSpot"},
"redir":{
"originalURL":"http://detectportal.firefox.com/success.txt",
"redirectionURL":"",
"logoutURL":"http://10.1.0.1:3990/logoff",
"ipAddress":"10.1.0.2",
"macAddress":"28-D2-44-70-04-00"
}
}
{
"version":"1.0",
"clientState":1,
"nasid":"ZA-VM1",
"redir": {
"originalURL":"http://detectportal.firefox.com/success.txt",
"redirectionURL":"",
"logoutURL":"http://10.1.0.1:3990/logoff",
"ipAddress":"10.1.0.2",
"macAddress":"28-D2-44-70-04-00"
},
"session":{
"sessionId":"161241022400000001",
"userName":"click_to_connect@demo1",
"startTime":1612410289,
"sessionTimeout":0,"terminateTime":0,
"idleTimeout":0,
"maxTotalOctets":249823541
},
"accounting":{
"sessionTime":15,
"idleTime":0,
"inputOctets":144606,
"outputOctets":85859,
"inputGigawords":0,
"outputGigawords":0,
"viewPoint":"client"
}
}
logon
Get the latest challenge
Each time we do a call to the status end point we get a new challenge in the reply.
CoovaChilli remembers the last challenge it generated for a client (when they are not logged in) and uses that during the login process.
This is why its good practice to do a statuscall as step one of the login process to get a fresh challenge from CoovaChilli. (There is an expiry on the challenge which is why we go this route to ensure we have a current value that hane not expired)
The call to the status end point was already covered earlier in the document. From it you can see there is a challenge item.
llogoff