Skip to main content

Deploy with scripts (VAPIX)

Axis cameras expose VAPIX, an HTTP API. You can install and configure Anava Edge on any number of cameras with curl. Cameras use Digest authentication, so use --anyauth.

Set CAMERA_PASSWORD in your shell (for example read -s CAMERA_PASSWORD; export CAMERA_PASSWORD) and replace CAMERA_IP and file names with your own values. Never store real passwords in scripts you share.

warning

Use HTTPS on untrusted networks. Over plain HTTP, the password and the settings can be seen on the network. Keep credentials in a secured file or secret store.

Install or upgrade​

curl --anyauth -u "root:$CAMERA_PASSWORD" \
-F "packfil=@AnavaAgent.eap" \
"http://CAMERA_IP/axis-cgi/applications/upload.cgi"

The camera answers OK on success. Common errors:

AnswerMeaning
Error: 2The signature was not accepted.
Error: 27Vendor mismatch on an upgrade.

Start the app​

curl --anyauth -u "root:$CAMERA_PASSWORD" \
"http://CAMERA_IP/axis-cgi/applications/control.cgi?action=start&package=AnavaAgent"

Set a setting​

curl --anyauth -u "root:$CAMERA_PASSWORD" \
"http://CAMERA_IP/axis-cgi/param.cgi?action=update&root.AnavaAgent.LiteVMSDescription=on"

For secrets or long values, send a POST with a form body instead of a URL, so the value stays out of logs:

curl --anyauth -u "root:$CAMERA_PASSWORD" \
--data-urlencode "action=update" \
--data-urlencode "root.AnavaAgent.LiteVMSDescription=on" \
"http://CAMERA_IP/axis-cgi/param.cgi"

Loop over many cameras: PowerShell 7​

Make cameras.csv with a header row:

ip,user,password
192.0.2.10,root,CHANGE_ME
192.0.2.11,root,CHANGE_ME
foreach ($cam in Import-Csv cameras.csv) {
$base = "http://$($cam.ip)/axis-cgi"
$cred = "$($cam.user):$($cam.password)"
Write-Host "== $($cam.ip)"
$out = curl.exe --fail --silent --show-error --anyauth -u $cred -F "packfil=@AnavaAgent.eap" "$base/applications/upload.cgi"
if ($LASTEXITCODE -ne 0 -or $out -notmatch '^OK') { Write-Host "Stopped at $($cam.ip): $out"; break }
curl.exe --fail --silent --show-error --anyauth -u $cred "$base/applications/control.cgi?action=start&package=AnavaAgent"
if ($LASTEXITCODE -ne 0) { Write-Host "Stopped at $($cam.ip): start failed"; break }
}

Loop over many cameras: bash​

while IFS=, read -r ip user pass; do
[ "$ip" = "ip" ] && continue
echo "== $ip"
out=$(curl --fail --silent --show-error --anyauth -u "$user:$pass" \
-F "packfil=@AnavaAgent.eap" "http://$ip/axis-cgi/applications/upload.cgi") \
|| { echo "Stopped at $ip"; break; }
case "$out" in OK*) ;; *) echo "Stopped at $ip: $out"; break ;; esac
curl --fail --silent --show-error --anyauth -u "$user:$pass" \
"http://$ip/axis-cgi/applications/control.cgi?action=start&package=AnavaAgent" \
|| { echo "Stopped at $ip: start failed"; break; }
done < cameras.csv

Tips​

  • Test on one camera first.
  • Wrong passwords can lock a camera out after a few tries. Both loops stop at the first failure: an HTTP or authentication error (--fail), or an upload that does not answer OK (upload.cgi answers Error: <code> with HTTP 200).
  • Upgrading keeps settings. Reinstalling the same version, or an older one, resets them.
  • To copy a whole settings set instead of single parameters, use the .cfg file from the console (Fleet template, then Exports) with AXIS Device Manager.
  • After the install, open the console to set up a camera: Open and sign in to the console.