Host is dropping Scanning API POSTs : Meraki API for Location Services

Solved
Sakul
Getting noticed

Host is dropping Scanning API POSTs : Meraki API for Location Services

Hi,

I am building a API for MR33 AP. I follow the https://developer.cisco.com/meraki/ 's Location Services steps.

1. In my PC, use sample Meraki Python script, import Flask, run API server => successful

2. In my PC, run ngrok http 5000 => successful

3. In Meraki Dashboard, Enable Scanning API, Got Validator key, Enter Validation key into step1, Enter Post URL from ngrok in Step2, run "Validate" button => Validated successfully

4.In my PC, Flask showed "200 OK" and Python program was waiting for POST data to come...

However, there was no data from Meraki Dashboard coming.

 

So, I checked at Meraki Dashboard, I saw the Post URLs status is red, and scanning message said "HTTP 404 : Host is dropping Scanning API POSTs"

 

What has i missed, please anyone advise?

Thanks,

Sakul

p.s. I noticed that in the Meraki Dashboard > Location and scanning > Post URL, there is a "Secret" field.
However, in your https://developer.cisco.com/meraki/ Location Services, I do not see any line verifying the "secret" key in the Python sample script. Is that the case ?

1 Accepted Solution
PhilipDAth
Kind of a big deal
Kind of a big deal
8 Replies 8
PhilipDAth
Kind of a big deal
Kind of a big deal
Sakul
Getting noticed

Thanks PhilipDAth.. You pointed me to the right Python script. Now I can see POST data coming to my Flask... 😊

But there is still some error as the POST data is printed only when I hit Ctrl-C (breaking the Python script). Sure, there is something in the script I need to adjust to fix this problem. (as I am new to Python, i need to study more). I will update again once I got it fixed.  

btw, here is the POST data I got..

 

ADMIN@ITP-L14 MINGW64 ~/src (master)
$ python Test2.py
validator: df736cd94e69dd73798eafe13817133e1689b4aa
secret: AbCdE123
* Serving Flask app "Test2" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://0.0.0.0:5001/ (Press CTRL+C to quit)

127.0.0.1 - - [03/Feb/2020 16:48:47] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [03/Feb/2020 16:49:34] "POST / HTTP/1.1" 400 -
127.0.0.1 - - [03/Feb/2020 16:50:26] "GET / HTTP/1.1" 200 -
validator sent to: 127.0.0.1
{'data': {'apFloors': ['Floor1'],
'apMac': '68:3a:1e:32:7a:ac',
'apTags': [],
'observations': [{'clientMac': 'ed:e7:3c:cf:85:b1',
'location': {'lat': 12.688286142539678,
'lng': 101.20759695768356,
'unc': 49.0,
'x': [82.30788682382314],
'y': [78.04068234754824]},
'name': '',
'rssi': -91,
'seenEpoch': 1580721296,
'seenTime': '2020-02-03T09:14:56Z'}]},
'secret': 'AbCdE123',
'type': 'BluetoothDevicesSeen',
'version': '2.1'}
Received POST from 127.0.0.1
secret verified: AbCdE123
invalid version
validator sent to: 127.0.0.1

ADMIN@ITP-L14 MINGW64 ~/src (master)

PhilipDAth
Kind of a big deal
Kind of a big deal

>invalid version

 

You have the wrong version configured in the dashboard (needs to be "2.0").

Sakul
Getting noticed

Yes, PhilipDAth... Meraki API is sending version "2.1"
so I changed the Python script (line 43) to "2.1", and now I have POST / 200 OK status...

Thanks again!

'type': 'BluetoothDevicesSeen',
'version': '2.1'}
Received POST from 127.0.0.1
secret verified: AbCdE123
version verified: 2.1
Bluetooth Devices Seen

Sakul
Getting noticed

and after the "version" is correct. POST data starts to flow to my console.. So I think all my problems are now solved.
PhilipDAth
Kind of a big deal
Kind of a big deal

No.  The real problem has started now.  What to do with the data! 

Sakul
Getting noticed

ha ha ha, actually what i want to achieve is warehouse asset tracking. I plan to buy beacons (from Kontakt or Estimote).
And since this script gives me "bluetooth clients" data, I wonder once I have beacons .. will the beacon data show here as well?
PhilipDAth
Kind of a big deal
Kind of a big deal

If you have enabled it in the dashboard, yes.

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.