REST API: Difference between revisions

From Aquarium-Control
Jump to navigation Jump to search
Line 76: Line 76:
The API shall provide an endpoint communicating the Balling dosing events read from the table <code>ballingdosinglog</code> of either the last 24 hours or the last 7 days depending on parameter provided by the client.
The API shall provide an endpoint communicating the Balling dosing events read from the table <code>ballingdosinglog</code> 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:
The corresponding SQL query (for a period of one day) is:
<code>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</code>
<code>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</code>



Revision as of 08:37, 20 November 2025

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

The API shall provide an endpoint communicating 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

Architecture

Testing