Skip to content

How the API for video downloads works (simplified)

Daniel Fernau edited this page Jan 27, 2021 · 2 revisions

v1.x documentation

  1. POST to /api/auth with JSON payload `{"username": "your_username", "password":"your_password"}``
    • returns status code 401 if credentials are wrong
    • returns status code 200, some JSON data with information about the authenticated user and an Authorization header containing an OAuth Bearer Token
  2. POST to /api/auth/access-key with Authorization header containing the previously requested Bearer Token
    • returns status code 401 if token is invalid
    • returns status code 200 and JSON data containing the accessKey
  3. GET from /api/bootstrap with Authorization header containing the previously requested Bearer Token
    • returns status code 401 if token is invalid / user is not authorized
    • returns status code 200 and JSON data with information about the system, the cameras, etc.

Then

Download video file
GET from /api/video/export with parameters ?accessKey=<the_access_key>&camera=<camera_id>&start=<segment_start_as_unix_time_in_milliseconds>&end=<segment_end_as_unix_time_in_milliseconds>

  • returns a video file containing the available footage within the requested time frame in .mp4 format
  • additional optional parameters include channel=<channel_id>, filename=<output_filename.mp4>, ...

or

Download camera snapshot
GET from /api/cameras/{camera_id}/snapshot with parameter ?accessKey=<the_access_key>

  • returns a jpg/jpeg image file containing a current snapshot of the camera
  • additional optional parameters include force=true, ts=<timestamp_as_unix_time_in_milliseconds>, ...