We will take advantage of Eagle Eye annotation api that allows us to annotate a video as well as retrieve the annotated data.
A good use case is when we want to send a Kisi lock/unlock event into eagle video stream data during a lock/unlock action.
1. A sample Kisi event (lock event) which we will try to send to Eagle Eye is as represented as a JSON below:
"message": "John Doe (firstname.lastname@example.org) unlocked lock Main Door.",
2. We can send these events to eagle eye create annotation api, on a successful request to Eagle Eye Api, we get a response containing a UUID (Universal Unique Identifier), the camera id, and time stamp. The time stamp represents the time at which we sent the event to Eagle Eye
3. Get annotation: We are now able to retrieve the annotation/events we sent via the Eagle Eye get annotation api.
Tying It Together
We can automate these steps using workflow automation tools like Zapier, we’ll go through how we can achieve that below:
Fig 1. An overview of the steps required to automate sending events to Eagle Eye from Kisi
1. Create Zap on Zapier
2. Select Kisi on Zapier
3. Define Kisi Trigger on Zapier
Currently, Kisi has only the event trigger listed on Zapier, select this and click on continue and choose your account.
4. Add Action 1 (Authenticate Eagle Eye)
The Eagle Eye api requires that you authenticate first. A token is given. This single use token is valid for a predefined duration or until it has been used. Once the Authentication Token is obtained, it will be used to authorize in the next step.
- Chose Post in Webhooks by Zapier
- Input https://login.eagleeyenetworks.com/g/aaa/authenticate in the url field
- Specify payload type as JSON
- Specify your Eagle Eye account username and password in the data field
- Click continue and press action to ensure that the request is successful
5. Add Action 2 (Authorize Eagle Eye)
Authorize Eagle Eye by using the token returned in step 4 above. Authorization is the final step of the login process performed by utilizing the token from Authenticate. A successful Authorize call returns an authorized user object and sets the 'auth_key' cookie. For all subsequent API calls either the cookie can be set or the value of it can be sent as the 'A' parameter.
6. Send Events to Eagle (Create Annotation)
Using events retrieved in Kisi from Step 3, we define a webhook PUT request to Eagle Eye
7. Test your action to confirm that Authentication, Authorization with Eagle Eye and sending Kisi events to Eagle Eye are now fully automated.
Sending Kisi Events to Eagle Eye is a simple three-step process that can be fully automated. Also, we can automate retrieving these events by using the Eagle Eye get annotation api. Preferably, you can automate this whole process as well.