Scanning API sample receiver version 1 outdated

Kind of a big deal

Scanning API sample receiver version 1 outdated

Hello all,


I wanted to play around with the scanning API yesterday and I noticed that the source code of the Sample Version 1 Receiver code on this link was a bit outdated and no longer worked for me:


I wanted to share the things I needed to fix to get it to work:

  • Connect middleware isn't shipped with express anymore so I had to install it manually after installing express:
sudo npm install connect
  • Due to that reorganisation in the nodejs modules the code also changed a bit, see the source code below for an updated version.
  • Also on the Meraki end, the structure of the JSON post changed, and some names were slightly changed. this too caused some changes in the source code.

Here's the edited source code that works:

// nodejs Meraki Presence receiver by Kris Linquist ( updated by @BrechtSchamp on the Meraki Community
// Prerequisite: the express node module and the connect node middleware.  Use 'sudo npm install express' and 'sudo npm install connect' to install. 
// Then start this script with 'nodejs merakiReceiver.js' (sudo required if port <1024)
// Meraki will send a HTTP GET request to test the URL and expect to see the validator as a response. 
// When it sends the presence information, it will also send the secret.  This script validates that the secret is correct prior to parsing the data.
// This script listens for the uri {request_uri}:port/meraki
// Tested on RPi running raspbian 9.8 stretch with node.js v9.11.2 and npm version v5.6.0

var listenport = 9201; //TCP listening port var secret = "xxxxxxxxxxxxx"; //Secret that you chose in the Meraki dashboard var validator = "xxxxxxxxxxxxxxxxx"; //Validator string that is shown in the Meraki dashboard var express = require('express'); var app = express(); var bodyParser = require('body-parser'); app.use(bodyParser.json()); app.get('/meraki', function(req, res) { res.send(validator); console.log("sending validation") });'/meraki', function(req, res) { try { var jsoned = req.body; if (jsoned.secret == secret) { for (i = 0; i <; i++) { console.log("client " +[i].clientMac + " seen on ap " + + " with rssi " +[i].rssi + " at " +[i].seenTime); } res.sendStatus(200); // to let the dashboard know parsing went fine } else { console.log("invalid secret from " + req.connection.remoteAddress); } } catch (e) { // An error has occured, handle it, by e.g. logging it console.log("Error. Likely caused by an invalid POST from " + req.connection.remoteAddress + ":"); console.log(e); res.end(); } }); app.listen(listenport); console.log("Meraki presence API receiver listening on port " + listenport);

Hope it helps someone down the line!

Meraki Employee



Thanks for sharing your findings.


FWIW, the more recent version of the Scanning API documentation is on the site.


The newer doc provides a few other examples (node, python, etc). The Node version I wrote has the package.json file etc included, so it handled the changes with the NPM libraries.




Thanks for the reply!


I do notice that the outdated sample code is still referred to in the scanning api docs, and it's drawing my attention more than your sample code :P.


Great work!

Hi @DexterLaBora 


I am trying out from I am able to display on my console the devices connected to Wifi by setting RadioType:Wifi in the dashboard. However I am getting an error of 'invalid version' when choosing RadioType: Bluetooth even though I have chosen API2 version on the dashboard as well. 


Is there any extra step that I need to perform in order to have this script successfully run? How do I overcome the 'invalid version' error? Thanks.

Update your python script with the version being sent from your network. It is likely 2.1 in your situation. 



validator = "EnterYourValidator"
secret = "EnterYourSecret"
version = "2.1" 


Version 3 has a different JSON shape. But since the script is super basic and simply prints the value, you can still receive these payloads too. 

Get notified when there are additional replies to this discussion.
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.