Skip to content

Network POST

The Man edited this page Jan 23, 2022 · 6 revisions

Set network configuration.

URL : /api/network/
Method : POST
Auth required : NO (subject to change)

Example Body

{
  "ssid": "my ssid",
  "psk": "my psk",
  "isAP": false
}

Usage

This endpoint only accepts POST requests using the application/json content header.
Failure to provide this header will result in a 404 response.

Not all parameters must be supplied when POSTing to the endpoint.
Only the parameters specified in your body will be changed.

Notes

  • Both SSID and PSK must be supplied if you wish to change either of those.
    • Only supplying one of these parameters will result in an error.
  • Changes POSTed to this endpoint will not result in an automatic reboot.
    The ESP32 only sets up its WiFi connection once at boot time.

Parameters

Below is a list of all parameters that can be presented in the request body:

ssid / psk

Saves the SSID and PSK of a network you wish to connect do.
This data will be used at boot time.

Payload

{
	"ssid": <string>,
	"psk": <string>
}

isAP

Specifies if the ESP32 should act as an Access Point or not.
This is only checked at boot.

Payload

{
	"isAP": <bool>
}
  • true
    • The ESP32 wll start as an Access Point.
  • false
    • The ESP32 will attempt to connect to a network using saved SSID and PSK data.
      • These parameters can be

Error handling

The whole request body gets validated once received by the system.
If a parameter or value violates the authentication set as dictated by the system, the whole request gets discarded and will instead return a 400 response.

Clone this wiki locally