Connect Wi-Fi
1. API Description
This API is used to connect Wi-Fi.
Request mode: POST [ip]/api/network/wifi-connect
Administrator Rights | Logged-in |
---|---|
Yes | Yes |
2. Input Parameters
Name | Required | Type | Description |
---|---|---|---|
iface | Yes | String | The network card name, wlan0 |
ssid | Yes | String | The Wi-Fi name |
password | Yes | String | Password. If an empty character is filled in, it indicates a Wi-Fi network that is not encrypted or a Wi-Fi network that has been connected to before. |
is-auto | Yes | Boolean | Whether to connect automatically. true: Yes; false: No |
3. Output Parameters
Name | Type | Description |
---|---|---|
status | Int | Status code |
4. Example
Connecting a Wi-Fi named "magewell".
Input Example
{
"iface": "wlan0",
"ssid": "magewell",
"password": "",
"is-auto": true
}
Output Example
{
"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 |
---|---|---|
6 | MW_STATUS_UNKNOWN_ERROR | Location error. The target SSID does not exist |
7 | MW_STATUS_INVALID_ARG | Missing required parameters |
11 | MW_STATUS_DEVICE_BUSY | The wireless network card does not exist |