Files
rpi-sensors/docs.md
2020-11-14 01:29:28 +01:00

1.3 KiB

Quick Documentation

Available endpoints:

  • GET /<root>

    • Display the chart homepage, by default the chart will show the last 60 minutes, updating every 30 seconds.
  • GET /<root>?show-minutes=120

    • Display the chart homepage, overriding the default 60 minutes to the desired number.
  • POST /<root>

    • Submit a snapshot to the database in the format of the following example JSON:
    {
        "time": "2020-11-13 22:20:44.651953",
        "temp": 25.2, 
        "humidity": 65.4, 
        "co2": 450
    }
    
  • GET /<root>/data

    • Retrieve a json of data snapshots over the last 60 minutes in the following format:
    {
      "snapshots": [
        {
          "id": 8868,
          "time": "2020-11-13 20:00:12",
          "temp": 21.7,
          "humidity": 57.3,
          "co2": 958
        },
        {
          "id": 8867,
          "time": "2020-11-13 19:59:42",
          "temp": 21.7,
          "humidity": 57.3,
          "co2": 957
        },
        // ...
      ]
    } 
    
  • GET /<root>/data/now

    • In the same format as above, retrieve the latest snapshot.
  • GET /<root>/data?since=2006-01-02T15:04:05Z

    • In the same format as above, retrieve all snapshots recorded since the given ISO date.