API Reference

API Reference

Basic GET Requests: Idempotent reading status from the Rearview

FunctionalityHTTP MethodPathExample curl CommandReturn information and status codeDetails
Basic test connectionGET/curl http://velovision-rearview.local:8000"Welcome to Velovision Rearview", 200
Battery state of charge (%)GET/battery-percentcurl http://velovision-rearview.local:8000/battery-percentSuccess: Percentage(int), 200. Failure: "Failed to get battery state of charge", 500Percent is rounded to nearest integer, e.g. 87, with no percent sign. May exceed 100.
Battery cell voltage in millivoltsGET/battery-millivoltscurl http://velovision-rearview.local:8000/battery-millivoltsSuccess: mV(int), 200. Failure: "Failed to get battery voltage", 500Rounded to the nearest mV, e.g. 3845.
CPU Temperature (degrees Celcius)GET/cpu-tempcurl http://velovision-rearview.local:8000/cpu-tempSuccess: 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 SuppliedGET/is-chargingcurl http://velovision-rearview.local:8000/is-chargingSuccess: 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 videosGET/list-local-videoscurl http://velovision-rearview.local:8000/list-local-videos[{"path": "/opt/standalone_videos/log0001.mkv","date_updated":"1713198307"},...], 200
Download specified video as .mp4GET/download-videocurl -o log0001.mp4 http://velovision-rearview.local:8000/download-video?/opt/velovision/standalone_videos/log0001.mkv200The 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 videoGET/download-thumbnailcurl -o log0001.jpg http://velovision-rearview.local:8000/download-thumbnail?/opt/velovision/standalone_videos/log0001_1713198307.jpg200The 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 Paths, it returns "Unknown GET request" with status code 501.