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
Is the video stream live?GET/camera-stream-statuscurl http://velovision-rearview.local:8000/camera-stream-status"true" or "false", 200We assume the video stream is a TCP Stream at port 5000 and return its status.
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.
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.

Basic PUT requests: Idempotent sending control commands to the Rearview

FunctionalityHTTP MethodPathExample curl CommandReturn information and status codeDetails
Start blinking LEDPUT/blink-oncurl -X PUT http://velovision-rearview.local:8000/blink-on"Turned on LED", 200
Stop blinking LEDPUT/blink-offcurl -X PUT http://velovision-rearview.local:8000/blink-off"Turn off LED", 200

If the server receives a PUT request without one of the above valid Paths, it returns "Unknown PUT request" with status code 501.