API Reference
Basic GET Requests: Idempotent reading status from the Rearview
Functionality | HTTP Method | Path | Example curl Command | Return information and status code | Details |
---|---|---|---|---|---|
Basic test connection | GET | / | curl http://velovision-rearview.local:8000 | "Welcome to Velovision Rearview", 200 | |
Battery state of charge (%) | GET | /battery-percent | curl http://velovision-rearview.local:8000/battery-percent | Success: Percentage(int), 200. Failure: "Failed to get battery state of charge", 500 | Percent is rounded to nearest integer, e.g. 87 , with no percent sign. May exceed 100. |
Battery cell voltage in millivolts | GET | /battery-millivolts | curl http://velovision-rearview.local:8000/battery-millivolts | Success: mV(int), 200. Failure: "Failed to get battery voltage", 500 | Rounded to the nearest mV, e.g. 3845 . |
CPU Temperature (degrees Celcius) | GET | /cpu-temp | curl http://velovision-rearview.local:8000/cpu-temp | Success: CPU temperature, 200. Failure: "Failed to read CPU temperature", 500. | Temperature is rounded nearest integer, e.g. 50 with no degrees C sign. |
External Power Supplied | GET | /is-charging | curl http://velovision-rearview.local:8000/is-charging | Success: boolean, 200. Failure: "Failed to get charging status", 500. | True means USB-C power connector is plugged in and supplying power. False means it is not. |
Get path and update time of standalone videos | GET | /list-local-videos | curl http://velovision-rearview.local:8000/list-local-videos | [{"path": "/opt/standalone_videos/log0001.mkv","date_updated":"1713198307"},...] , 200 | |
Download specified video as .mp4 | GET | /download-video | curl -o log0001.mp4 http://velovision-rearview.local:8000/download-video?/opt/velovision/standalone_videos/log0001.mkv | 200 | The query string (after ? ) is the full path to the .mkv video on the server, as provided by list-local-videos . The video is saved as log0001.mp4 in the current directory. The video is converted to .mp4 format before being sent to the client. The .mp4 file is deleted on the server immediately after being sent to the client. |
Download thumbnail image for a given video | GET | /download-thumbnail | curl -o log0001.jpg http://velovision-rearview.local:8000/download-thumbnail?/opt/velovision/standalone_videos/log0001_1713198307.jpg | 200 | The query string (after ? ) is the full path to the thumbnail on the Server. The file name is the same as the video file name, with the timestamp appended. |
If the server receives a GET
request without one of the above valid Path
s, it returns "Unknown GET request" with status code 501.