Adding new camerasΒΆ

In case you have admin permissions, you will be able to add new cameras to the database. In that case, here is the list of attributes that each camera needs in order to be added to the database:

Required:

  • camera_id - id of the camera (has to be unique)
  • lat - latitude where camera is located
  • lng - longitude where camera is located
  • ip or url - one of the two, depending if you are adding IP or Non_IP camera (has to be unique)

Highly suggested (These can sometimes be determined from the latitutude-longitude combination, but in some cases this is not possible, so the data provided by the user is used instead):

  • city - city where the camera is located

Optional:

  • port - only relevant if it is an IP camera, if nothing specified default is 80
  • source - provider of the camera
  • source_url - url of the camera provider
  • description - description of the camera (max 100 characters)
  • framerate - framerate of the camera (frames per second)
  • resolution_w - resolution width of the image provided by the camera
  • resolution_h - resolution height of the image provided by the camera
  • is_video - camera is a video stream (True or False)
  • outdoors - camera is outdoors (True or False)
  • traffic - camera recording traffic (True or False)
  • inactive - camera is not active (True or False)

When POST request is sent to the server at the URI <cam2api_domain>/cameras, server will either respond with the camera’s JSON showing the camera as added to the database, or it will return appropriate error code and the message describing the error that was encountered while adding camera to the database.

Example of a bash script adding a camera:

#!/bin/bash
DATA='{"camera_id": 13452,
       "city": "Nairobi",
        "ip": "10.0.0.11",
        "lat": -1.2804,
        "lng": 36.8163,
        "source": "google",
        "source_url": "www.google.com",
        "resolution_w": 1920,
        "resolution_h": 1080}'
curl --header "Content-Type: application/json" --data "$DATA" <cam2api_domain>/cameras/