Documentation
Interfaces

There are multiple interfaces provided by the eNetMini device for developing the homepage. Due to the rather little system memory and processing power of the embedded device, there is no server-side language (e.g. PHP) provided, and thus the obtaining and processing of the data takes mainly place on the client side (Browser).

Server Side Include (SSI)

The SSI calls are the only method of filling the page with information on the server side. They work as simple text replacements. The contents can be internal system variables, contents of another files or the REST-API data.

SSI description example call
include Puts the contents of the specified file in the place of the call <!--#include file=header.inc–>
echo Puts the value of the specified variable in the place of the call internal variable: <!--#echo var=time–>
REST: <!--#echo var=/api/v1/process–>
Note
In order for a SSI call to work, it needs to be included in a .shtml file.
Other file extensions do not work.
SSI Call description
#echo var=battery returns the state of the battery as percentage
#echo var=temperature returns the internal temperature of the CPU in degrees Celsius
#echo var=time returns the current system time in Unix timestamp format
#echo var=uptime returns the time in seconds since last powering on (up time)
#echo var=status returns a string containing:
- number of errors which occurred in the runtime
- state of dhcp client
- state of sntp client
- and the state of mqtt client
#echo var=ipaddr returns the currently used IP address.
#echo var=ipmask returns the currently used subnet mask.
#echo var=macaddress returns the physical addres (MAC) from the bootloader
#echo var=appname returns the application's name (e.g. mkc1901_std)
#echo var=appversion returns the application's version
#echo var=bootversion returns the bootloader's version
#echo var=bootfilemode returns the current step of a system update
#echo var=boottestmode returns the mode of the firmware

Common Gateway Interface (CGI)

The CGI scripts provide a simple way of accessing critical functions of the devices, such as the system update (FSU, force system update) ot the homepage update (FHU, force homepage update) and other settings of the device, not accessible with the REST-API.

CGI parameters description
getbattery.cgi - returns the state of the battery as percentage
gettemperature.cgi - returns the internal temperature of the CPU in degrees Celsius
gettime.cgi - returns the current system time in Unix timestamp format
settime.cgi time Sets the current system time.
time - the time in Unix timestamp format
getuptime.cgi - returns the time in seconds since last powering on (up time)
geterror.cgi - returns a json object with the last 10 errors.
getstatus.cgi - returns a string containing:
- number of errors which occurred in the runtime
- state of dhcp client
- state of sntp client
- and the state of mqtt client
reset.cgi time restarts the device.
time - waiting time till the reset.
fhu.cgi tftp, file starts the FHU (Force Homepage Update)
tftp - IP Address of the TFTP-Server
file - filename of the compiled homepage
fsu.cgi time, step starts the FSU (Force System Update)
time - waiting time till the start of the FSU
step - the starting step of the FSU
getmacaddress.cgi - returns the physical addres (MAC) from the bootloader
getappname.cgi - returns the application's name (e.g. mkc1901_std)
getappversion.cgi - returns the application's version
getbootversion.cgi - returns the bootloader's version
getbootfilemode.cgi - returns the current step of a system update
getboottestmode.cgi - returns the mode of the firmware

The scripts themselves are implemented in the firmware. For accessing them, the developer has to create empty files with the corresponding filenames. These files can be put anywhere in the homepage and so they can have different access rights (see section HTTP Authentication). The fsu.cgi script is, in addition to the individual placement, always accessible under "/su/fsu.cgi". This ensures that the device can always be reset to default, even if the fsu.cgi script is missing.

In order to run a CGI script, it has to be accessed by a simple HTTP GET request.

REST API

The REST-API is the main method of communication with the eNetMini. The API runs on the HTTP protocol and the exchanged data is formatted as a JSON document.

The data of the device is split up into 8 different json structures.

path description
/api/v1/device information about the hardware
/api/v1/properties the properties of the device (network settings etc.)
/api/v1/process IO's configurations
/api/v1/data IO's data
/api/v1/apikeys access keys for the API
/api/v1/httpro HTTP authentication data for user "RO"
/api/v1/httprw HTTP authentication data for user "RW"
/api/v1/httpsu HTTP authentication data for user "SU"

The documentation for the REST API and can be found here