Links

Get Snapshot from Cisco Meraki Camera

Snapshots from a Cisco Meraki camera can be used within the Plainsight Platform to start building a model.
To get a snapshot from the camera use of the "Generate Device Camera Snapshot" API will be needed.
Additional documentation for Meraki APIs can be found here: Cisco Meraki Interactive API Docs
Required information:
  • Serial number of camera
  • API Key for a Cisco account with appropriate access
The below is a Python example of how to use the "Generate Device Camera Snapshot" API to save a snapshot.
import io
import json
import requests
import time
# Serial number of camera
serial = "[Camera Serial Number]"
# API Key associated with a Cisco Accou
api_key = "[Cisco API Key]"
# Required headers for API Endpoint
headers = {
"Content-Type": "application/json",
"X-Cisco-Meraki-API-Key": api_key
}
# API Endpoint URL for generating snapshots
url = f"https://api.meraki.com/api/v1/devices/{serial}/camera/generateSnapshot"
# Trigger snapshot
response = requests.request('POST', url, headers=headers)
print(response.json())
# Get the URL of the snapshot
img_url = response.json()['url']
# Snapshots are not instant and a few seconds are needed before they are avilable.
time.sleep(3)
# Get snapshot
snapshot_img = requests.get(img_url)
# Save image
with open("/[file path]/test_image.jpeg", 'wb') as f:
f.write(snapshot_img.content)
Once snapshots have been created, they will need to be loaded into a datasource to be used by the Plainsight platform. See Collect Data for more information.
The data must then be labeled as defined by a labelling schema. See Label for more information.
After the data has been labelled, a version created, training can begin. See Train Your Model with SmartML™ for more information.
Once training is complete, the model can be deployed and new data can be sent to the API endpoint. See Deploy Your Model for more information on how to deploy a model.
See Get Inferences from Cisco Meraki Camera for information on how to use the deployed model.