Skip to content

Instantly share code, notes, and snippets.

@anikishov
Created July 11, 2019 20:44
Show Gist options
  • Save anikishov/730e1ee42ca441887c54471f75808568 to your computer and use it in GitHub Desktop.
Save anikishov/730e1ee42ca441887c54471f75808568 to your computer and use it in GitHub Desktop.
watcher api v2
#!/bin/bash
url=$1
api_key=$2
mask=$3
if [ -z $url ] || [ -z $api_key ] || [ -z $mask ]; then
echo "Argument not found: script.sh /*watcher address*/ \$1 /*vsaas-api-key*/ \$2 /*stream filter*/ \$3"
exit 0
else
curl -s -v $url/vsaas/api/v2/cameras -H x-vsaas-api-key:$api_key | awk '/name/{print $2}' | awk 'gsub(/\"|,/,"")' | grep $mask |
while read line;
do curl -s $url/vsaas/api/v2/cameras/$line -X DELETE -H x-vsaas-api-key:$api_key
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment