AP Northbound-API-User-Guide - v1.9
AP Northbound-API-User-Guide - v1.9
Change records
JiangYan Yu 20-11-2017 The first draft is completed;
JiangYan Yu 30-11-2017 The content is changed as follows:
1. Delete wlan.enable.
JiangYan Yu 29-01-2018 The content is changed as follows:
1. Add the effective value(wpa3) of the encryptionType parameter in the wlan.create method.
1. Add the pmf parameter in the wlan.create method and wlan.get method.
For the Northbound requirements, we provide six objects: user, ap, system, wlan, rf,downloader.
The web developer first needs to call the system.getPvc method via the following url to get the pvcip.
Url:
http://anyip address:8080/apiaccess
After that through the following url with pvcip call user.logIn method to get the session.
Url:
http://pvcip address:8080/apiaccess
If the PVC switch, you need to re-run Step1 to get a new pvcip.
After that through the following url with pvcip call other methods, each call must carry the session.
Url:
http://pvcip address:8080/apiaccess
Only by re-executing Step2 to get a valid session, other methods can be called normally.
Step 4: Logout
Finally, when you no longer call other methods, you need to call the user.log_out method to delete the
session by using the following url.
Url:
http://pvcip address:8080/apiaccess
Url:
http://Desired AP ip address:8080/apiaccess
API details
1.user object
For the user object, provide two methods: user.logIn, user.logOut.
user.logIn
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "user.logIn",
"params": {
"username":"Administrator",
"password":"21232f297a57a5a743894a0e4a801fc3"
}
}
Note:
1.Only use the Administrator account to log in.
2.The value of id ranges from -2147483648 to 2147483647. If the value you set for the id is
greater than the maximum, it will return you 2147483647. If the value you set for the id is less
than the minimum value, it will return you -2147483648.
3.The id in all of the following methods are like this. I would like to explain here, and I
won't repeat it later.
Request Parameters:
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Login success/Login log account lock/Login log Password
error xxx/Login log account banned/Login log saveSessionid error/login log saveSessionValid
error/Please access pvc/No params/No username/No password/Can not get password/The username is
not Administrator",
"sessionId":"2eb79fc698f7894349fe2605f37fdf3e"
}
}
Return Values:
Valid session, call other methods must be carry it. If success is false, then
sessionId string
there will be no sessionId parameter.
user.logOut
Description:
Request:
{
"id": 4,
"jsonrpc": "2.0",
"method": "user.logOut",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {}
}
Response:
{
"id": 4,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/Log out success/Log out fail/Please access
pvc"
}
}
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
2.ap object
For the ap object, provide three methods: ap.getSystemInfo, ap.getClient, ap.setStaticIp.
ap.getSystemInfo
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "ap.getSystemInfo",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"apmac":"aa:bb:cc:dd:ee:ff"
}
}
Request Parameters:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"apinfo":{
"model": "OAW-AP1221",
"mac": "aa:bb:cc:dd:ee:ff",
"ip": "192.168.20.1",
"uptime": 95458,
"version": "3.0.0.57",
"location": "home"
},
"success": "true/false",
"message": "No id/No method/Invalid session/Please access pvc/No params/Ubus lookup id
failed/Ubus call nbm failed, status = xxx/Failed to get nbm return value/No topic/Mqtt pub
fail/Mqtt timeout/Get ap info success"
}
}
Return Values:
apinfo object The details of ap. If success is false, then there will be no apinfo object.
ap.getClient
Description:
Get the total number of clients connected on an ap, and also get the list of client connected on
an ap.
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "ap.getClient",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"apmac":"aa:bb:cc:dd:ee:ff"
}
}
Request Parameters:
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"total": 1,
"users": [
{
"on_line": true,
"mac": "b0:e2:35:24:e6:54",
"ap": "46:07:5a:fa:a2:6a",
"vap": "46:07:5a:fa:a2:77",
"wlanid": 3,
"radioid": 1,
"AssocationSSID": "123",
"AttachedBand": 5,
"Channel": 161,
"AuthType": "OPEN",
"Portal_username": "",
"ip": "192.168.20.189",
"uptime": 15,
"livetime": 0,
"signal": 35,
"mode": 19,
"rx_rate": 390000,
"rx_wifirate": 1733300,
"rx_bytes": 72129,
"tx_rate": 27000,
"tx_wifirate": 1733300,
"tx_bytes": 53132,
"portal_enable": false,
"portal_type": "wifidog",
"portal_state": "know",
"devtype": "Mobile",
"hostname": "MI5-xiaomishouji",
"ostype": "Android",
"devmodel": "",
"cputype": "",
"delaytime": 9999999,
"packetloss": 100,
"rx_retr": 0,
"tx_retr": 0,
"up_package": 165,
"down_package": 735,
"up_rate": 6,
"down_rate": 4
}
]
"success": "true/false",
"message": "No id/No method/Invalid session/Please access pvc/No params/Ubus lookup id
failed/Ubus call nbm failed, status = xxx/Failed to get nbm return value/No topic/Mqtt pub
fail/Mqtt timeout/Get clients success/Um return error"
}
}
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
Return the list of clients info connected on an ap. If success parameter is false,
users array
then there will be no users parameter.
ap.setStaticIp
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "ap.setStaticIp",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"apmac":"aa:bb:cc:dd:ee:ff",
"staticip":"192.168.20.188",
"netmask":"255.255.254.0",
"gateway":"192.168.21.254",
"dns":"219.141.136.10"
}
}
Request Parameters:
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/No params/Ubus lookup id failed/Ubus call
nbm failed, status = xxx/Failed to get nbm return value/Please access pvc/The parameter is
wrong: xxx/Mqtt pub fail/Mqtt timeout/Apmanage return error/Set ip fail/Set ip success"
}
}
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
system.saveConfig
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "system.saveConfig",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {}
}
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/Please access pvc/Ubus lookup id failed/Ubus
call nbm failed, status = xxx/Failed to get nbm return value/Mqtt pub fail/Mqtt timeout/Uc
return error/Save config success"
}
}
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
system.getPvc
Description:
Show which ap is the pvc. Accessed by username & password
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "system.getPvc",
"params": {
"username":"Administrator",
"password":"21232f297a57a5a743894a0e4a801fc3"
}
}
Note: Only use the Administrator account to log in.
Request Parameters:
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"pvcip": "192.168.20.1",
"success": "true/false",
"message": "No id/No method/Get pvc success/Can not get password/Password wrong/No
params/No username/No password/The username is not Administrator"
}
}
Return Values:
result type description
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
Return the ip address of pvc. The web developer first needs to call the method
pvcip string
to get the pvcip. If success is false, then there will be no pvcip parameter.
system.getApList
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "system.getApList",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {}
}
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"aps": [
{
"ap_name": "AP-2B:E0",
"mac": "b0:e2:35:24:2b:e0",
"ip": "192.168.20.189",
"status": 3,
"role": 1,
"version": "3.0.3.13"
},
{
"ap_name": "AP-E6:54",
"mac": "b0:e2:35:24:e6:54",
"ip": "192.168.20.182",
"status": 3,
"role": 2,
"version": "3.0.3.13"
}
],
"success": "true/false",
"message": "No id/No method/Invalid session/Please access pvc/Ubus lookup id failed/Ubus
call nbm failed, status = xxx/Failed to get nbm return value/Can't execute command/Get aplist
success/The aplist is null"
}
}
Note: Before the PVC is not elected, the result obtained by calling this method is incorrect.
When there are many devices in the cluster, it may take a few minutes to elect PVC. When there
are few devices in the cluster, it may take a few seconds to elect a PVC.
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
system.setPassword
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "system.setPassword",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"password": "e10adc3949ba59abbe56e057f20f883e"
}
}
Request Parameters:
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/No params/Ubus lookup id failed/Ubus call
nbm failed, status = xxx/Failed to get nbm return value/Please access pvc/No password/Mqtt pub
fail/Mqtt timeout/Apmanage return error/Set password success/Set password fail"
}
}
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
system.setGroupInfo
Description:
Set the group info: name, location, management IP, management netmask, group ID.
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "system.setGroupInfo",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"group_name": "AP-Group",
"group_location": "office",
"group_mgtip": "192.168.20.46",
"group_mgtnetmask": "255.255.254.0",
"group_id": 8888
}
}
Note:
1.Group will be reorganized if you modify the group_id, at the same time pvc may change.
After setting the group_id successfully, please wait 20s and then log in again.
2.The lighttpd certificate will be recreated and loaded if you modify the group_mgtip.
So you may not receive a reply.
Request Parameters:
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/No params/Ubus lookup id failed/Ubus call
nbm failed, status = xxx/Failed to get nbm return value/Please access pvc/The parameter is
wrong:xxx/The group ip and netmask must be set together/This group_mgtip can't be the same as
the ip of the aps in the group/The obtained pvcip is incorrect, and the groupip cannot be
verified/This group_mgtip and pvcip are not in a network segment/Mqtt pub fail/Mqtt
timeout/Apmanage return error/Set group info success/Set group info fail/Set group id success,
Please wait for 20s and then log in again"
}
}
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
4.wlan object
For the wlan object, provide four methods: wlan.create, wlan.delete, wlan.get, wlan.list.
wlan.create
Description:
Create or modify the various type of essid. It can be controllable time based.
Allow creation of a essid as standard open.
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "wlan.create",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"essid":"mywifi",
"actionrange":"group", //"group" or "all"
"groupList": [
"aa:bb:cc:dd:ee:f0",
"aa:bb:cc:dd:ee:f1",
"aa:bb:cc:dd:ee:f2"
],
"allowBand":"all",
"ssidEnable":"enable",
"hideSSID":"disable",
"securityLevel":"Personal", //"Personal" or "Open" or "Enterprise"
"encryptionType":"wpa3-psk-sae-aes",
"pmf":"Optional",
"passphrase":"12345678",
"ap_bridge":"enable",
"broadcastFilterARP":"disable",
"multicastOptimization":"disable",
"maxClientsPerBand":13,
"e0211rStatus":"disable",
"e0211kStatus":"disable",
"e0211vStatus":"disable",
"okcStatus":"enable",
"wlanTimer":{
"enable":false,
"periodType":"daily", //"daily" or "weekend" or "weekday"
"period":{
"enable":false, //false:all day, true:period start.
"startTime":"10:59", // hour and mins
"endTime":"22:59"
}
},
"upstreamBandwidth":3,
"downstreamBandwidth":4,
"redirectStatus":"disable",
"vlanNumber":123,
"AuthServer":{
"authenticationPort":1812,
"authIp":"192.168.21.123",
"authSecret":"2345678"
},
"radiusAccounting": true,
"AccServer":{
"accountingPort":1813,
"accountIp":"192.168.21.111",
"accountSecret":"123456"
}
}
}
Note:
1.No matter which ap is applied to each WLAN, the number of wlan configured for each radio band
can not more than seven.
2.If you want to modify an existing wlan, just execute the wlan.create method again.
Request Parameters:
params type validation description
authenticationPort: 1-
65535, authIp: valid IP, If the securityLevel is Enterprise,
AuthServer object authSecret: 1-64 characters these parameters need to be filled.
except space. It also can't If not, it does not need to be filled.
include `="'
params type validation description
Please refer to [Request If the enable is true, the period object need to
period object
period Parameters] be filled. If not, it does not need to be filled.
If the enable is false, this wlan effective all day. If not, this wlan
enable bool true/false
effective from startTime to endTime.
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/No params/Ubus lookup id failed/Ubus call
nbm failed, status = xxx/Failed to get nbm return value/Please access pvc/The parameter is
wrong: xxx/Mqtt pub fail/Mqtt timeout/Wlan return error/Create wlan fail/Create wlan success/The
number of wlan configured for each radio band can not more than seven"
}
}
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
Description:
For example:
If you want to disable the WLAN "mywifi", you just need to modify the value of the "ssidEnable"
to disable, other attributes should be kept consistent with before.
{
"id": 1,
"jsonrpc": "2.0",
"method": "wlan.create",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"essid":"mywifi",
"actionrange":"group", //"group" or "all"
"groupList": [
"aa:bb:cc:dd:ee:f0",
"aa:bb:cc:dd:ee:f1",
"aa:bb:cc:dd:ee:f2"
],
"allowBand":"all",
"ssidEnable":"disable",
"hideSSID":"disable",
"securityLevel":"Personal", //"Personal" or "Open" or "Enterprise"
"encryptionType":"wpa3-psk-sae-aes",
"pmf":"Optional",
"passphrase":"12345678",
"ap_bridge":"enable",
"broadcastFilterARP":"disable",
"multicastOptimization":"disable",
"maxClientsPerBand":13,
"e0211rStatus":"disable",
"e0211kStatus":"disable",
"e0211vStatus":"disable",
"okcStatus":"enable",
"wlanTimer":{
"enable":false,
"periodType":"daily", //"daily" or "weekend" or "weekday"
"period":{
"enable":false, //false:all day, true:period start.
"startTime":"59:10", // mins and hour
"endTime":"59:22"
}
},
"upstreamBandwidth":3,
"downstreamBandwidth":4,
"redirectStatus":"disable",
"vlanNumber":123,
"AuthServer":{
"authenticationPort":1812,
"authIp":"192.168.21.123",
"authSecret":"2345678"
},
"radiusAccounting": true,
"AccServer":{
"accountingPort":1813,
"accountIp":"192.168.21.111",
"accountSecret":"123456"
}
}
}
Note: No matter which ap is applied to each WLAN, the number of wlan configured for each radio
band can not more than seven.
wlan.delete
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "wlan.delete",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"essid":"mywifi"
}
}
Request Parameters:
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/No params/Ubus lookup id failed/Ubus call
nbm failed, status = xxx/Failed to get nbm return value/Please access pvc/No essid/Mqtt pub
fail/Mqtt timeout/Wlan return error/The essid is not exist/Delete wlan fail/Delete wlan success"
}
}
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
wlan.get
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "wlan.get",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"essid":"mywifi"
}
}
Request Parameters:
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/No params/Ubus lookup id failed/Ubus call
nbm failed, status = xxx/Failed to get nbm return value/Please access pvc/The essid is not
exist/No essid/Get wlan info error/Get wlan info success",
"wlaninfo": {
"essid":"mywifi",
"actionrange":"group", //"group" or "all"
"groupList": [
"aa:bb:cc:dd:ee:f0",
"aa:bb:cc:dd:ee:f1",
"aa:bb:cc:dd:ee:f2"
],
"allowBand":"all",
"ssidEnable":"enable",
"hideSSID":"disable",
"securityLevel":"Enterprise",
"encryptionType":"wpa3-psk-sae-aes",
"pmf":"Optional",
"ap_bridge":"enable",
"broadcastFilterARP":"disable",
"multicastOptimization":"disable",
"maxClientsPerBand":13,
"e0211rStatus":"disable",
"e0211kStatus":"disable",
"e0211vStatus":"disable",
"okcStatus":"enable",
"wlanTimer":{
"enable":true,
"periodType":"daily", //"daily" or "weekend" or "weekday"
"period":{
"enable":true,
"startTime":"10:59", // hour and mins
"endTime":"22:59"
}
},
"upstreamBandwidth":3,
"downstreamBandwidth":4,
"redirectStatus":"disable",
"vlanNumber":123,
"AuthServer":{
"authenticationPort":1812,
"authIp":"192.168.21.123"
},
"radiusAccounting": true,
"AccServer":{
"accountingPort":1813,
"accountIp":"192.168.21.111"
}
}
}
}
Return Values:
If the interface is called successfully and the essid exists, this parameter is
success string true.If the interface fails to call or the essid doesn't exist, this parameter is
false.
If success is true, wlaninfo will display the details of the wlan. Please refer to
wlaninfo object
[Return wlanInfo Values] for details.
securityLevel enum
pmf enum
broadcastFilterARP enum
multicastOptimization enum
maxClientsPerBand integer
e0211kStatus enum
e0211vStatus enum
wlanTimer object
upstreamBandwidth integer
downstreamBandwidth integer
vlanNumber integer
params type description
wlan.list
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "wlan.list",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {}
}
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/Ubus lookup id failed/Ubus call nbm failed,
status = xxx/Failed to get nbm return value/Please access pvc/Get essid list fail/Get essid list
success",
"ssidList":[
"mywifi1",
"mywifi2",
"mywifi3"
]
}
}
Return Values:
result type description
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
5. rf object
For the rf object, provide one method: rf.setRadio.
rf.setRadio
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "rf.setRadio",
"session": "038e1d7b1735c6a5436ee9eae095879e",
"params": {
"actionrange":"group", //"group" or "all"
"groupList": [
"aa:bb:cc:dd:ee:f0",
"aa:bb:cc:dd:ee:f1",
"aa:bb:cc:dd:ee:f2"
],
"2.4G":"enable",
"5G_all":"enable",
"5G_high":"enable",
"5G_low":"enable"
}
}
Note: For the four parameters of 2.4G/5G_all/5G_high/5G_low,you only need to send the parameters
which you want to set, and don't need to send them all.
Request Parameters:
params type validation description
Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "true/false",
"message": "No id/No method/Invalid session/No params/Ubus lookup id failed/Ubus call
nbm failed, status = xxx/Failed to get nbm return value/Please access pvc/The parameter is
wrong: xxx/Mqtt pub fail/Mqtt timeout/RF return error/Set radio fail/Set radio success"
}
}
Return Values:
If the interface is called successfully, this parameter is true.If the interface fails
success string
to call, this parameter is false.
6. download object
For the download object, provide one method: download.snapshotLog.
download.snapshotLog
Description:
Request:
{
"id": 1,
"jsonrpc": "2.0",
"method": "download.snapshotLog",
"params": {
"username":"Administrator",
"password":"21232f297a57a5a743894a0e4a801fc3"
}
}
Note: Only use the Administrator account to log in.
Request Parameters:
Response:
Note:
If the interface fails to call,the following error reason will be returned;
If the interface is called successfully, it will directly return the log compressed package.
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": "false",
"message": "No id/No method/No params/No username/No password/The username is not
Administrator/Password wrong/Collection log failed/Collection log timeout/Open path:xxx failed"
}
}
Return Values:
result type description