文章目录
Gain network status information
API instructin
gain network status information of the device
Request
- Method: GET/POST
- URL:
network/get.json
- Headers:
- submit parameter: no
Response
- Body
{
"result": "ok",
"data": [
{
"dns": "",
"dynamic": "n",
"gw3": "",
"mask3": "255.255.255.0",
"ip2": "192.168.1.168",
"device": "eth0",
"ip3": "",
"mask2": "255.255.255.0",
"ip": "192.168.1.120",
"mask": "255.255.255.0",
"state": "down",
"gw": "192.168.1.1",
"mac": "62:FF:ED:10:D4:B3",
"gw2": ""
},
{
"dns": "8.8.8.8",
"dynamic": "n",
"gw3": "",
"mask3": "255.255.255.0",
"ip2": "192.168.2.168",
"device": "eth1",
"ip3": "",
"mask2": "255.255.255.0",
"ip": "192.168.2.123",
"mask": "255.255.255.0",
"state": "up",
"gw": "192.168.2.1",
"mac": "62:87:55:E1:A3:2B",
"gw2": ""
}
]
}
return instruction:
network parameter arrays
field | type | instruction |
---|---|---|
device | alphabetic string | network port,value range:”eth0” or”eth1” |
ip | alphabetic string | ip address |
mask | alphabetic string | sub network mask code |
mac | alphabetic string | mac address |
gw | alphabetic string | gateway IP |
dynamic | alphabetic string | DHCP or not,”y”or “dhcp” refers to working under DHCP mode,”static” static IP |
dns | alphabetic string | DNS address |
ip2 | alphabetic string | ip 2 |
mask2 | alphabetic string | subnet mask 2 |
gw2 | alphabetic string | gateway 2 IP |
ip3 | alphabetic string | ip address 3 |
mask3 | alphabetic string | sub network mask code 3 |
gw3 | alphabetic string | gateway 3 IP |
test interface:
http://192.168.2.123/api/network/get.json
Confugure network interface parameter
API instruction
modify the network configuration
Request
- Method: GET/POST
- URL:
network/modify.json
- Headers:
- submit parameter:
field | type | instruction |
---|---|---|
device | alphabetic string | network port,value range:”eth0” or”eth1” |
ip | alphabetic string | ip address |
mask | alphabetic string | subnet mask |
mac | alphabetic string | mac address |
gw | alphabetic string | gateway IP |
dynamic | alphabetic string | DHCP or not,”y”or “dhcp” refers to working under DHCP,”static” static IP |
dns | alphabetic string | DNS address |
ip2 | alphabetic string | ip 2 |
mask2 | alphabetic string | subnet mask 2 |
gw2 | alphabetic string | gateway 2IP |
ip3 | alphabetic string | ip address 3 |
mask3 | alphabetic string | subnet mask 3 |
gw3 | alphabetic string | gateway 3 IP address |
Response
- Body
{
"result": "ok"
}
test interface:
http://192.168.2.123/api/network/modify.json?device=eth1&ip=192.168.2.123&gw=192.168.2.1&mask=255.255.255.0&dns=8.8.8.8&dynamic=n&mac=62:87:55:E1:A3:2B