Configure Network Settings
:info: Example application
To illustrate this section, we have included a sample app in our open source projects called app-wifi, which is available in our Github.
Network Info
This section returns network information registered with the host machine Network Manager. Shows network information for all Ethernet and WiFi devices, including current network addresses and MAC addresses. Here is a sample request
GET Request
http://{{dashboardHost}}/api/{{dashboardVersion}}/machine/{{dashboardMachine}}/network/info
JSON Response
{
"code": "",
"details": "",
"body": {
"devices": [
{
"addresses": [
"192.168.11.25/24"
],
"device_id": "eno1",
"technology": "ETHERNET",
"hardware_address": "54:B2:03:09:16:A4",
"ssid": "",
"gateway": "192.168.11.1"
},
{
"addresses": [],
"device_id": "wlp1s0",
"technology": "WIFI",
"hardware_address": "96:7D:64:E1:2E:BB",
"ssid": "",
"gateway": ""
}
]
}
}
WifiScan
This request will return all available wifi access points and their signal strength
GET Request
http://{{dashboardHost}}/api/{{dashboardVersion}}/machine/{{dashboardMachine}}/network/WiFiScan
JSON Response
{
"code": "",
"details": "",
"body": {
"visible_access_points": [
{
"ssid": "OAK_5g",
"hardware_address": "5C:E2:8C:D9:B7:C1",
"strength_percent": 94
},
{
"ssid": "OAK",
"hardware_address": "5C:E2:8C:D9:B7:C0",
"strength_percent": 89
}
]
}
}
Add Wifi
Adds or overwrites configuration for connecting to a specific WiFi network. The host will then attempt to connect to the network whenever it is available. These settings are persisted until ForgetWifi
is used.
POST Request
http://{{dashboardHost}}/api/{{dashboardVersion}}/machine/{{dashboardMachine}}/network/AddWiFi
So if you had added the environmental variable for {{wifi-ssid}}
and {{wifi-password}}
POST Request Body
{
"ssid": "{{wifi-ssid}}",
"passphrase": "{{wifi-password}}"
}
you could then query the following id see it added to the host machine's Network Manager
List Known Wifi Networks
Lists the WiFi network configurations that are available to this host.
http://{{dashboardHost}}/api/{{dashboardVersion}}/machine/{{dashboardMachine}}/network/ListKnownWiFiNetworks
Note that the password is kept private and not listed in this response
JSON Response
{
"code": "",
"details": "",
"body": {
"wifi_networks": [
{
"ssid": "OAK",
"passphrase": ""
}
]
}
}
Forget Wifi
This simply will forget the defined SSID
POST Request
http://{{dashboardHost}}/api/{{dashboardVersion}}/machine/{{dashboardMachine}}/network/ForgetWiFi
Request Body
{
"ssid": "{{wifi-ssid}}"
}