Google App Script to take a MV camera snapshot results in 404 error

FelixLam98
Meraki Employee
Meraki Employee

Google App Script to take a MV camera snapshot results in 404 error

I am getting ERROR when trying to call UrlFetchApp.fetch(url,options) from Google App Script. 

 

var options = {
'method' : 'POST',
'headers': {'X-Cisco-Meraki-API-Key': xxxxxxxxx'},
'contentType': 'application/json'

};

 

option1=JSON.stringify(options);
Logger.log(option1);


var response = UrlFetchApp.fetch('https://api.meraki.com/api/v0/networks/L_xxxx84193406xxxxxx/cameras/xxxx-xxxx-xxxx/snapshot', options);

I am getting the error at line "var response = UrlFetchApp.fetch()"

 

2 REPLIES 2
chengineer
Meraki Alumni (Retired)
Meraki Alumni (Retired)

Hi Felix, I finally got a chance to look into this, and the issue has to do how JavaScript/GApps script is handling CORS. The easiest/quickest fix here is to change your URL from https://api.meraki.com to use the shard number, for example https://n118.meraki.com instead.

Solutions Architect @ Cisco Meraki | API & Developer Ecosystem

Hi shay, thanks so much for solving my problem! I found out which shard I'm on from my dashboard url. Thanks so much. You are a genius!

Get notified when there are additional replies to this discussion.