Get Wi-Fi list
1. API Description
This API is used to get the Wi-Fi list.
Request mode: POST [ip]/api/network/wifi-scan-results
Administrator Rights | Logged-in |
---|---|
Yes | Yes |
2. Input Parameters
Name | Required | Type | Description |
---|---|---|---|
iface | Yes | String | The network card name, wlan0 |
3. Output Parameters
Name | Type | Description |
---|---|---|
status | Int | Status code |
connect | WiFiData | The information of the current connected Wi-Fi |
user-iterms | WiFiData | The information of the previously connected Wi-Fi |
scan-items | WiFiData | The information of other available Wi-Fi |
WiFiData
Name | Type | Description |
---|---|---|
ssid | String | The Wi-Fi name |
state | Int | The connection status 0: Idle, no connection 1: Connecting 2: Connected 3: Wrong password 4: Connection failed 5: Connection timeout |
bssid | String | The MAC address of the Wi-Fi |
frequency | Int | The network frequency |
signal | Int | The signal strength |
encryption | String | The encryption mode, including NONE, WEP, WPAPSK, WPA2PSK |
is-auto | Boolean | Whether auto-connection is allowed true: Yes; false: No |
is-used | Boolean | Whether connection succeeds true: Yes; false: No |
use-dhcp | Boolean | Whether DHCP is used to get IP address true: Yes; false: No |
ipaddr | String | IP address |
netmask | String | Subnet mask |
gateway | String | Gateway address |
dns | String | DNS information |
4. Example
Getting the available Wi-Fi list.
Input Example
{
"iface": "wlan0"
}
Output Example
{
"connect": {
"ssid": "magewell-GUEST",
"state": 2
},
"user-items": [
{
"ssid": "magewell-GUEST",
"bssid": "9e:a6:7e:5d:8f:66",
"frequency": 5220,
"signal": -36,
"encryption": "WPA2PSK",
"is-auto": false,
"is-used": true,
"use-dhcp": true,
"ipaddr": "192.168.21.215",
"netmask": "255.255.255.0",
"gateway": "192.168.21.1",
"dns": ""
}
],
"scan-items": [
{
"ssid": "magewell009",
"bssid": "8c:53:c3:3a:a0:da",
"frequency": 2422,
"signal": -66,
"encryption": "WPAPSK",
"is-auto": false,
"is-used": false
}
],
"status": 0
}
5. Error Code
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Status | Definition | Description |
---|---|---|
7 | MW_STATUS_INVALID_ARG | Missing required parameters |
11 | MW_STATUS_DEVICE_BUSY | The wireless network card does not exist |