REST API
Requirements
General requirements
The API shall communicate with mobile apps and dynamic webpage.
For each request, the API shall validate the credentials (user, password).
The API shall provide the data in JSON format.
Timestamps shall have the format: YYYY-MM-DD hh:mm:ss
Requirements for overview feature
The API shall provide an endpoint for informing the client about the validity of the credentials.
The API shall provide an endpoint communicating a set of floating point data read from a set of files:
| Signal name | Signal format | Signal source |
|---|---|---|
| timestamp | string | /var/local/aquarium-ctrl/aquarium-ctrl-ts |
| water temperature | floating point number | /var/local/aquarium-ctrl/atlsscntfc-temp |
| filtered water temperature | floating point number | /var/local/aquarium-ctrl/atlsscntfc-tempfltrd |
| pH value | floating point number | /var/local/aquarium-ctrl/atlsscntfc-ph |
| filtered pH value | floating point number | /var/local/aquarium-ctrl/atlsscntfc-phfltrd |
| conductivity | floating point number | /var/local/aquarium-ctrl/atlsscntfc-conduc |
| filtered water temperature | floating point number | /var/local/aquarium-ctrl/atlsscntfc-conducfltrd |
| tank level switch position | floating point number | /var/local/aquarium-ctrl/tnklvlsswtch |
| surface ventilation status | string | /var/local/aquarium-ctrl/srfcvntltn |
| ambient temperature | floating point number | /var/local/aquarium-ctrl/ambtemp |
| ambient humidity | floating point number | /var/local/aquarium-ctrl/ambhum |
| heating status | string | /var/local/aquarium-ctrl/htng |
Requirements for Balling feature
Balling dosing log
The API shall provide an endpoint communicating from the server to the client the Balling dosing events read from the table ballingdosinglog of either the last 24 hours or the last 7 days depending on parameter provided by the client.
The corresponding SQL query (for a period of one day) is:
SELECT ballingdosinglog.Timestamp, ballingdosinglog.pumpid, ballingdosinglog.dosingvolume, ballingsetvals.label FROM `ballingdosinglog` LEFT JOIN ballingsetvals ON ballingdosinglog.pumpid=ballingsetvals.pumpid WHERE Timestamp > (NOW() - INTERVAL 1 DAY) ORDER BY Timestamp
| Signal name | Signal format | Database column name |
|---|---|---|
| timestamp | string | ballingdosinglog.Timestamp |
| pump id | integer number | ballingdosinglog.pumpid |
| dosing volume | floating point number | ballingdosinglog.dosingvolume |
| label | string | ballingsetvals.label |
Balling set values
The API shall provide an endpoint communicating from the server to the client the Balling dosing set values read from the table ballingsetvals.
The corresponding SQL query is:
SELECT pumpid, dosingvolume, label FROM `ballingsetvals`
| Signal name | Signal format | Database column name |
|---|---|---|
| pump id | integer number | ballingsetvals.pumpid |
| dosing volume | floating point number | ballingsetvals.dosingvolume |
| label | string | ballingsetvals.label |