esp8266_web_settings beta
Public Member Functions | List of all members
grmcdorman::device::WebServerRestApi Class Reference

This class provides a REST API for the attached devices. More...

#include <grmcdorman/device/WebServerRestAPI.h>

Public Member Functions

void setup (AsyncWebServer &server, const std::vector< Device * > &devices)
 Set up with the web server. More...
 

Detailed Description

This class provides a REST API for the attached devices.

This leverages the Definitions list in the Devices to create the API end points, and the publish method to serve requests.

Member Function Documentation

◆ setup()

void grmcdorman::device::WebServerRestApi::setup ( AsyncWebServer &  server,
const std::vector< Device * > &  devices 
)

Set up with the web server.

This must be called after the devices have been added. The URIs for the devices, and the device list URI, will be registered with the server.

The URIs added are:

  • /rest/devices/get to return all devices
  • /rest/device/_device-id_/get to return values for one device
Parameters
serverWeb server to install API on.
devicesList of devices to install end-points for. A reference is held to this; this list must exist for the lifetime of this object.

The documentation for this class was generated from the following files: