API

For now, the API (application programming interface) supports endpoints to:

  • set the dynamic text overlays
  • change live stream settings

API key

Get the SECRET-API-KEY from dashboard -> Profile settings. The WEBCAM-ID is shown in the webcams list.

This is an example API call using the curl command:

curl -H 'Content-Type: application/json' \
  -H 'X-Auth-Email: YOUR@EMAIL' \
  -H 'X-Auth-Key: SECRET-API-KEY'  \
  -X PUT -d '{"dynamic_text1":"","dynamic_text2":""}' \
  "https://webcam.io/api/webcams/WEBCAM-ID"

Dynamic text overlay

Also see this blog post about dynamic text overlays

Example to update the value of the dynamic_text1 variable:

curl -H 'Content-Type: application/json' \
  -H 'X-Auth-Email: contact@webcam.io' \
  -H 'X-Auth-Key: 22l7kIX0AwdMcdpo7vlL'  \
  -X PUT -d '{"dynamic_text1":"temp: 10°C hyg: 50%","dynamic_text2":"wind: NE"}' \
  "https://webcam.io/api/webcams/m7g61z"

Live stream parameters

To change live stream parameters:

curl -H 'Content-Type: application/json' \
  -H 'X-Auth-Email: contact@webcam.io' \
  -H 'X-Auth-Key: 22l7kIX0AwdMcdpo7vlL' \
  -X PUT -d '{"stream_enabled": true,"backup_stream_enabled": false,"stream_src_url":"rtsp://example.com","stream_dest_url":"rtmp://dest"}' \
  "https://webcam.io/api/webcams/m7g61z"

Parameters are optional. I.e. only settings ‘{“stream_enabled”: true}’ is also valid, so this can be called by an external scheduler to enable/disable streaming at a specific time.


Related Articles