cancel
Showing results for 
Search instead for 
Did you mean: 

Meraki Camera API Snapshot

Conversationalist

Meraki Camera API Snapshot

Hi,

 

I'm trying to take a snapshot by using the CURL giving the network id, the camera's serial number, and all the necessary data. However, when making the POST of the CURL, I get a 400 error Response.

 

HTTP ERROR 400
Problem accessing /cameras/live_snapshot. Reason:
     can't parse j son parameters: No content to map due to end-of-input

 

I'm not sure what the problem is exactly.

 

Thank You,

9 REPLIES 9
Kind of a big deal

Re: Meraki Camera API Snapshot

Can you post the curl command you're using? Be sure to redact your API key, serial and network ID.

Conversationalist

Re: Meraki Camera API Snapshot

Hi,

 

I'm using Python requests:

 

headers = {
                 'X-Cisco-Meraki-API-Key': API_KEY,
                 'Content-Type': 'application/json',
}

 

response = requests.post('https://api.meraki.com/api/v0/networks/'+NET_ID+'/cameras/'+SERIAL_CAM1+'/snapshot', headers=headers)

Kind of a big deal

Re: Meraki Camera API Snapshot

It looks like the API doc is wrong. remove the content-type json stuff and it works for me.

 

headers = {
                 'X-Cisco-Meraki-API-Key': API_KEY,
}
requests.post('https://api.meraki.com/api/v0/networks/<netID>/cameras/<serial>/snapshot', headers=headers)

Or

 

curl -L -H 'X-Cisco-Meraki-API-Key: <api_key>' -X POST 'https://api.meraki.com/api/v0/networks/<Net_ID>/cameras/<serial>/snapshot'
Conversationalist

Re: Meraki Camera API Snapshot

Thank you very much, now it works correctly Smiley Very Happy

Kind of a big deal

Re: Meraki Camera API Snapshot

Hey @TonyC  @CameronMoody  FYI looks like the API doc for Camera snapshots might have an error in it.

 

https://api.meraki.com/api_docs#generate-a-snapshot-of-what-the-camera-sees-at-the-specified-time-an...

 

Sorry if this isn't you guys, but I thought the API guy and the doc guy would be good places to start Smiley Happy

Meraki Employee

Re: Meraki Camera API Snapshot

Thanks for the report, we have reproduced and will address. For now omitting the application-type header appears to address as @jdsilva indicated
Here to help

Re: Meraki Camera API Snapshot

Hello @TonyC I am trying to fetch the snapshot through code, but there is no possible way, it only works in a browser... Do you have any example?

Conversationalist

Re: Meraki Camera API Snapshot

I used Python:

 

import requests
import json

API_KEY = 'YOUR_API_KEY'
NET_ID = 'YOUR_NETWORK_ID'
SERIAL_CAM = 'YOUR_CAMERA_SERIAL_NUMBER'

headers = {
                    'X-Cisco-Meraki-API-Key': API_KEY,
}

try:
      response = requests.post('https://api.meraki.com/api/v0/networks/'+NET_ID+'/cameras/'+SERIAL_CAM+'/snapshot', headers=headers)
except requests.exceptions.RequestException as e:
      print("Error: %s" %(e))

data = response.json()
url_link = data['url']
print(url_link)
Here to help

Re: Meraki Camera API Snapshot

I did it with node , the problem as described here https://community.meraki.com/t5/Solutions-APIs/Snapshot-API-not-working-404/td-p/45294 is that i did need to wait 5 seconds before fetching

Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.