Meraki switch JSON

Hi
  • Wireless Access points MR – http://ap.meraki.com
  • Switches MS – http://switch.meraki.com
  • Routers MX and Z1 – http://wired.meraki.com
  • Any – http://setup.meraki.com  This URL will work for any Cisco Meraki device, but will only access the first device in its path.
For example, if you’re on a PC connected to a Meraki switch you can connect to http://switch.meraki.com/ which gives you a status page about your connection.  This page has javascript to fetch data from a json document at http://switch.meraki.com/index.json
I’m reading this JSON from PowerShell at  machine startup to dynamically track PC to switch port mappings. For example, you could write this to the registry and extend SCCM hardware inventory to collect this as a machine property.  Or write it to an AD machine account property.
$MerakiJSON=invoke-restmethod -Uri http://switch.meraki.com/index.json
write-host "I'm connected to $($MerakiJSON.config.node_name) port $($MerakiJSON.client.port) which is configured as VLAN $($MerakiJSON.client.vlan)"
Result:
I'm connected to MS220-8P-LON2 port 5 which is configured as VLAN 2

Leave a Reply