Bulk Renaming Cameras
Sometimes you need to apply settings to a group of cameras. When a camera is added in Eagle Eye VMS it is named "New Camera" by default. I was asked to rename all these cameras and was given a spreadsheet with IP address and camera names. The cameras had previously been used with another VMS and had been assigned static IP addresses. It was an trivial task to get a list of cameras in the Eagle Eye VMS and match it to the spreadsheet.
Step 1: Login to the Eagle Eye API
The first step in working with our API is to login with your username, password and API key. All requests to our API should include the API key that you created. After the Authentication step, you will get a token which you will then need to pass into the Authorization step. We automatically return you the user information for the user who just logged-in.
Step 2: Get Available Devices
The currently logged-in user is able to get information about what devices they have been given access to. Once you had the cameras you can start the matching process.
Step 3: Match against the Spreadsheet
There are several ways to work with Excel files. You can export is a CSV, use an offically supported library, or in our case use OpenPyxl.
After you have injested the data from the spreadsheet the next thing is to iterate through it. Any time you do this kind of ETL operation you will need to do some amount of data clean-up. IP addresses (IPv4) are a known format so it isn't a complicated space to match on.
As you iterate through the cameras you can check to see if the name matches (makes the script idempotent) already or if it needs to change this camera. Changing the actual camera name is just updating the values with a POST to `/g/device`.
Step 4: Adding tags for future organization
While looping through all the cameras, it is a good time to consider added additional settings on the cameras. We allow you to tag a camera with abitrary strings to make it easier to organize your cameras. In the included code example we are tagging these cameras with the "ORD" tag (which is the airport code for O'Hare). In the future you could match on this tag instead of IP address.
What else can we do with this?
We have previously shown how to change user permissions, in this blog post we reviewed how to change camera settings. I hope you can see how using the Eagle Eye API makes managing large systems easy. You could use this same idea to synchronize the users and cameas with your own systems. It can provide the bridge between Active Directory and the Eagle Eye VMS.
I hope you found this helpful. If you have any questions please feel free to reach out to us at email@example.com