Meraki Dashboard API Web Service

Overview

This is a collection of several Cisco Meraki Dashboard API calls. The list is not comprehensive and is a work in progress but provides many of the popular API calls. With these flows, it will be easy to duplicate the calls and make minor adjustments to support any missing actions.

The flows consist of inject and http nodes that provide an easy way to interact with the Meraki API or provide your own backend web service for interacting with the Meraki API. This is useful when you want to build a front-end application where the web client cannot speak directly to Meraki because of the CORS cross-site scripting restrictions. It also provides centralized control of the Meraki API functions you want to expose to any user application.

Docs

The Meraki Dashboard API documentation will provide more details of the various capabilities. http://developers.meraki.com/tagged/Dashboard

Pre-requisites

Configuration

A Cisco Meraki network will be required to use these flows. In order to begin making API calls, the Meraki Organization must be configured with the API enabled.

  • Enable access to the Cisco Meraki Dashboard API Organization --> API Access: Enable

  • Create an API key Go to your Meraki profile and generate an API key.

The API key is used to make every API call. It will provide the same level of access (read/write) that your dashboard account has. It is important that you do not share this key.

Update the Environment Variables node. "

[tab]Global Settings --> Set Environment Variables

This will contain useful variables such as the API Key, shard number, organization ID, network ID, etc. The shard number is important for making most Post/Put calls. Meraki will perform a redirect from the starting point of dashboard.meraki.com to a particular "shard" or server group for your organization. This number can be found in the URL when you login to the dashboard.meraki.com and will look like http://n123.meraki.com. All other variables are used as a convenience when testing each API call using the inject nodes. The variables will provide the necessary parameters to test these call.

screenshot

Written by Cory Guynn

2017

www.InternetOfLEGO.com

developers.meraki.com

[{"id":"84a99143.8865e","type":"tab","label":"Global Settings"},{"id":"6e7f14f8.00b1fc","type":"tab","label":"Admins"},{"id":"aee95c7f.b5f35","type":"tab","label":"Clients"},{"id":"8d87025.671bb","type":"tab","label":"Config Templates"},{"id":"ddf70b09.e9b388","type":"tab","label":"Devices"},{"id":"53741f01.0a6a","type":"tab","label":"L3 Firewall"},{"id":"9696e4c4.ac1b68","type":"tab","label":"Networks"},{"id":"8fb42dac.3089d","type":"tab","label":"Organizations"},{"id":"b7438282.6118d","type":"tab","label":"Phone Contacts"},{"id":"ca265dbc.9dca2","type":"tab","label":"Phone Numbers"},{"id":"fa80bcd6.ee2d3","type":"tab","label":"SAML Roles"},{"id":"adb906fd.e68698","type":"tab","label":"SM"},{"id":"f295fd89.8ae63","type":"tab","label":"SSIDs"},{"id":"887aac8a.09e1b","type":"tab","label":"Static Routes"},{"id":"fc90633f.eb78","type":"tab","label":"Switch Ports"},{"id":"d7c0974d.3a3dd8","type":"tab","label":"VLANs"},{"id":"1cb3e834.2a9958","type":"tab","label":"VPN"},{"id":"ba9e2568.77a458","type":"tab","label":"Workflows"},{"id":"4a5fa8e6.495c18","type":"inject","z":"8fb42dac.3089d","name":"List Organizations","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":80,"wires":[["51945195.4de8f"]]},{"id":"51945195.4de8f","type":"function","z":"8fb42dac.3089d","name":"Meraki API - List Organizations","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar orgId = msg.orgId;\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\n\nmsg.url = \"https://dashboard.meraki.com/api/v0/organizations\";\nmsg.method = 'get';\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":80,"wires":[["cbbdf373.90fb9"]]},{"id":"cbbdf373.90fb9","type":"http request","z":"8fb42dac.3089d","name":"","method":"use","ret":"txt","url":"","tls":"","x":850,"y":80,"wires":[["a82b1db4.e65ca"]]},{"id":"55f52347.2b201c","type":"http in","z":"8fb42dac.3089d","name":"","url":"/meraki/api/organizations","method":"get","swaggerDoc":"","x":160,"y":120,"wires":[["51945195.4de8f"]]},{"id":"a82b1db4.e65ca","type":"function","z":"8fb42dac.3089d","name":"Large Int Helper","func":"const regex = /\"id\":(.*?)(?:,)/g;\nconst str = `{\"id\":351024,\"name\":\"Cisco Mini Demo 2\"},{\"id\":215332,\"name\":\"Cisco Mini Demo 1\"},`;\nlet m;\n\nwhile ((m = regex.exec(str)) !== null) {\n    // This is necessary to avoid infinite loops with zero-width matches\n    if (m.index === regex.lastIndex) {\n        regex.lastIndex++;\n    }\n    \n    // The result can be accessed through the `m`-variable.\n    m.forEach((match, groupIndex) => {\n        console.log(`Found match, group ${groupIndex}: ${match}`);\n    });\n}\n\n\nmsg.payload = msg.payload.replace(/\"id\":(.*?)(?:,)/g,\"\\\"id\\\"\\:\\\"$1\\\"\\,\");\nconsole.log(\"new json with regex replace \",msg.payload);\nreturn msg","outputs":1,"noerr":0,"x":1060,"y":80,"wires":[["fece1c18.2391"]]},{"id":"fece1c18.2391","type":"json","z":"8fb42dac.3089d","name":"","x":1250,"y":80,"wires":[["9e761d66.700d7","36338949.15d6c6"]]},{"id":"9e761d66.700d7","type":"http response","z":"8fb42dac.3089d","name":"","x":1390,"y":80,"wires":[]},{"id":"36338949.15d6c6","type":"debug","z":"8fb42dac.3089d","name":"List Orgs JSON","active":true,"console":"false","complete":"true","x":1360,"y":120,"wires":[]},{"id":"e1589c9c.be32c","type":"inject","z":"9696e4c4.ac1b68","name":"List Networks","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":110,"y":140,"wires":[["5f28999d.5849b8"]]},{"id":"5f28999d.5849b8","type":"function","z":"9696e4c4.ac1b68","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.orgId = global.get('orgId');\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":140,"wires":[["511eebd4.758f24"]]},{"id":"511eebd4.758f24","type":"function","z":"9696e4c4.ac1b68","name":"Meraki API - List Networks","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar orgId = msg.req.params.orgId;\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/organizations/\"+orgId+\"/networks\";\nmsg.method = 'get';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":140,"wires":[["f53dc7f7.d330f8"]]},{"id":"3e6160a9.108fb","type":"http in","z":"9696e4c4.ac1b68","name":"","url":"/meraki/api/organizations/:orgId/networks","method":"get","swaggerDoc":"","x":220,"y":180,"wires":[["511eebd4.758f24"]]},{"id":"f53dc7f7.d330f8","type":"http request","z":"9696e4c4.ac1b68","name":"","method":"use","ret":"obj","url":"","tls":"","x":970,"y":140,"wires":[["129b973f.2e6b09","124417e8.00f5c8"]]},{"id":"129b973f.2e6b09","type":"debug","z":"9696e4c4.ac1b68","name":"List Nets","active":true,"console":"false","complete":"true","x":1120,"y":180,"wires":[]},{"id":"124417e8.00f5c8","type":"http response","z":"9696e4c4.ac1b68","name":"","x":1130,"y":140,"wires":[]},{"id":"f3c1e1f4.12dc5","type":"inject","z":"8fb42dac.3089d","name":"List License State","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":200,"wires":[["3933f537.afac9a"]]},{"id":"3933f537.afac9a","type":"function","z":"8fb42dac.3089d","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.orgId = flow.get('orgId');\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":200,"wires":[["7e5c4475.6dac0c"]]},{"id":"7e5c4475.6dac0c","type":"function","z":"8fb42dac.3089d","name":"Meraki API - List License State","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar orgId = msg.req.params.orgId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/organizations/\"+orgId+\"/licenseState\";\nmsg.method = 'get';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":200,"wires":[["9f06a92e.a7f808"]]},{"id":"9f06a92e.a7f808","type":"http request","z":"8fb42dac.3089d","name":"","method":"use","ret":"obj","url":"","tls":"","x":970,"y":200,"wires":[["cb6dc336.acf14","be680be6.eebb28"]]},{"id":"73b7bd.143a8844","type":"http in","z":"8fb42dac.3089d","name":"","url":"/meraki/api/organizations/:orgId/licenseState","method":"get","swaggerDoc":"","x":230,"y":240,"wires":[["7e5c4475.6dac0c"]]},{"id":"cb6dc336.acf14","type":"http response","z":"8fb42dac.3089d","name":"","x":1130,"y":200,"wires":[]},{"id":"be680be6.eebb28","type":"debug","z":"8fb42dac.3089d","name":"List License State","active":true,"console":"false","complete":"true","x":1090,"y":240,"wires":[]},{"id":"d9f3972a.75ef68","type":"inject","z":"9696e4c4.ac1b68","name":"Create a Network","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":260,"wires":[["ed968996.c5c918"]]},{"id":"ed968996.c5c918","type":"function","z":"9696e4c4.ac1b68","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.orgId = global.get('orgId');\n\n// Sample Data\nmsg.payload = {\n    \"name\": \"API Test - Node-RED - \"+ (new Date().getMilliseconds()),\n    \"timeZone\": \"Europe/Amsterdam\",\n    \"tags\": \"APItest\",\n    \"type\": \"wireless\"\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":260,"wires":[["59dbae91.37746"]]},{"id":"59dbae91.37746","type":"function","z":"9696e4c4.ac1b68","name":"Meraki API - Create a Network","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar orgId = msg.req.params.orgId;\nvar shard = global.get('shard');\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/organizations/\"+orgId+\"/networks\";\nmsg.method = 'post';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":260,"wires":[["584fab9.5418054"]]},{"id":"584fab9.5418054","type":"http request","z":"9696e4c4.ac1b68","name":"","method":"use","ret":"obj","url":"","tls":"","x":970,"y":260,"wires":[["8072968e.d31358","bec6090d.d9c918"]]},{"id":"43d6a0fc.7120c","type":"http in","z":"9696e4c4.ac1b68","name":"","url":"meraki/api/organizations/:orgId/networks","method":"post","swaggerDoc":"","x":220,"y":300,"wires":[["59dbae91.37746"]]},{"id":"8072968e.d31358","type":"debug","z":"9696e4c4.ac1b68","name":"Create a Network","active":true,"console":"false","complete":"payload","x":1090,"y":300,"wires":[]},{"id":"bec6090d.d9c918","type":"http response","z":"9696e4c4.ac1b68","name":"","x":1130,"y":260,"wires":[]},{"id":"f71ff70.a122d08","type":"inject","z":"8d87025.671bb","name":"List Templates","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":160,"wires":[["b14e6734.0032e8"]]},{"id":"b14e6734.0032e8","type":"function","z":"8d87025.671bb","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.orgId = global.get('orgId');\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":160,"wires":[["538b765e.fb2448"]]},{"id":"538b765e.fb2448","type":"function","z":"8d87025.671bb","name":"Meraki API - List Templates","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar orgId = msg.req.params.orgId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/organizations/\"+orgId+\"/configTemplates\";\nmsg.method = 'get';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":160,"wires":[["6f1b6e.81bcd494"]]},{"id":"6f1b6e.81bcd494","type":"http request","z":"8d87025.671bb","name":"","method":"use","ret":"obj","url":"","tls":"","x":990,"y":160,"wires":[["e59eeb78.59cb08","846fdc09.adb59"]]},{"id":"276ac748.a932c8","type":"http in","z":"8d87025.671bb","name":"","url":"meraki/api/organizations/:orgId/configTemplates","method":"get","swaggerDoc":"","x":260,"y":200,"wires":[["538b765e.fb2448"]]},{"id":"e59eeb78.59cb08","type":"http response","z":"8d87025.671bb","name":"","x":1150,"y":160,"wires":[]},{"id":"846fdc09.adb59","type":"debug","z":"8d87025.671bb","name":"List Templates","active":true,"console":"false","complete":"payload","x":1120,"y":200,"wires":[]},{"id":"791de5ad.3a087c","type":"inject","z":"8d87025.671bb","name":"Bind to a Template","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":150,"y":280,"wires":[["34a5e389.5717bc"]]},{"id":"34a5e389.5717bc","type":"function","z":"8d87025.671bb","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.orgId = global.get('orgId');\n\n// Sample Data\nmsg.payload = {\n    \"configTemplateId\":\"L_643451796760560235\",\n    \"autoBind\": false\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":280,"wires":[["6b31466d.597538"]]},{"id":"6b31466d.597538","type":"function","z":"8d87025.671bb","name":"Meraki API - Bind to a Template","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/bind\";\nmsg.method = 'post';\n\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":280,"wires":[["28d6f3a7.afa31c"]]},{"id":"28d6f3a7.afa31c","type":"http request","z":"8d87025.671bb","name":"","method":"use","ret":"obj","url":"","tls":"","x":990,"y":280,"wires":[["2c451ba1.e5aa74","b0f98ad7.cc9508"]]},{"id":"23f2ebc0.4506d4","type":"http in","z":"8d87025.671bb","name":"","url":"meraki/api/networks/:netId/bind","method":"post","swaggerDoc":"","x":210,"y":320,"wires":[["6b31466d.597538"]]},{"id":"2c451ba1.e5aa74","type":"http response","z":"8d87025.671bb","name":"","x":1150,"y":280,"wires":[]},{"id":"b0f98ad7.cc9508","type":"debug","z":"8d87025.671bb","name":"Bind to a Template","active":true,"console":"false","complete":"true","x":1110,"y":320,"wires":[]},{"id":"f470eefb.f83cb","type":"inject","z":"8d87025.671bb","name":"Unbind from Template","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":160,"y":400,"wires":[["34c431e7.f287ce"]]},{"id":"34c431e7.f287ce","type":"function","z":"8d87025.671bb","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\n\n// Sample Data\nmsg.payload = {};\n\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":400,"wires":[["e357d4b8.f829d8"]]},{"id":"e357d4b8.f829d8","type":"function","z":"8d87025.671bb","name":"Meraki API - Unbind from Template","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/unbind\";\nmsg.method = 'post';\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":400,"wires":[["bac0b068.e254"]]},{"id":"bac0b068.e254","type":"http request","z":"8d87025.671bb","name":"","method":"use","ret":"obj","url":"","tls":"","x":990,"y":400,"wires":[["5af5b3cf.220b9c","9e9fb298.9448b"]]},{"id":"eb6063e2.80ba1","type":"http in","z":"8d87025.671bb","name":"","url":"meraki/api/networks/:netId/unbind","method":"post","swaggerDoc":"","x":220,"y":440,"wires":[["e357d4b8.f829d8"]]},{"id":"5af5b3cf.220b9c","type":"http response","z":"8d87025.671bb","name":"","x":1150,"y":400,"wires":[]},{"id":"9e9fb298.9448b","type":"debug","z":"8d87025.671bb","name":"Unbind from Template","active":true,"console":"false","complete":"payload","x":1108,"y":442,"wires":[]},{"id":"751a21a0.ddaef","type":"comment","z":"8d87025.671bb","name":"Bug: \"{\"errors\":[\"Validation failed: Handle has already been taken\"]}\"","info":"","x":460,"y":440,"wires":[]},{"id":"ae4a342f.b665c8","type":"inject","z":"ddf70b09.e9b388","name":"Remove a single Device","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":180,"y":500,"wires":[["9b8e2e3a.b0076"]]},{"id":"9b8e2e3a.b0076","type":"function","z":"ddf70b09.e9b388","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\n// Sample Data\nmsg.req.params.serial = global.get('serial');\nmsg.payload = {\n    \n};\n\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":500,"wires":[["d00343cb.bd30b"]]},{"id":"d00343cb.bd30b","type":"function","z":"ddf70b09.e9b388","name":"Meraki API - Remove a Single Device","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\nvar serial = msg.req.params.serial;\n\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/devices/\"+flow.get('serial')+\"/remove\";\nmsg.method ='post';\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":500,"wires":[["db65ab6c.34a478"]]},{"id":"db65ab6c.34a478","type":"http request","z":"ddf70b09.e9b388","name":"","method":"use","ret":"obj","url":"","tls":"","x":1010,"y":500,"wires":[["9e3eb1ca.6d9d2","f4d08618.ece748"]]},{"id":"97b0e8ef.f2a8b8","type":"http in","z":"ddf70b09.e9b388","name":"","url":"/meraki/api/networks/:netId/devices/:serial/remove","method":"post","swaggerDoc":"","x":290,"y":540,"wires":[["d00343cb.bd30b"]]},{"id":"9e3eb1ca.6d9d2","type":"debug","z":"ddf70b09.e9b388","name":"Remove a single Device","active":true,"console":"false","complete":"true","x":1110,"y":540,"wires":[]},{"id":"f4d08618.ece748","type":"http response","z":"ddf70b09.e9b388","name":"","x":1170,"y":500,"wires":[]},{"id":"70c465b4.8fab9c","type":"inject","z":"ddf70b09.e9b388","name":"List Devices","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":150,"y":100,"wires":[["bac4aa3.ccd2e58"]]},{"id":"bac4aa3.ccd2e58","type":"function","z":"ddf70b09.e9b388","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\n\n// Sample Data\nmsg.payload = {\n\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":100,"wires":[["f19da6ab.310f48"]]},{"id":"f19da6ab.310f48","type":"function","z":"ddf70b09.e9b388","name":"Meraki API - List Devices","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/networks/\"+netId+\"/devices/\";\nmsg.method = \"get\";\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":100,"wires":[["3c293f4d.6e3b"]]},{"id":"3c293f4d.6e3b","type":"http request","z":"ddf70b09.e9b388","name":"","method":"use","ret":"obj","url":"","tls":"","x":1010,"y":100,"wires":[["9ec7006b.c0899","81f3bae1.7b32a8"]]},{"id":"a567e748.127868","type":"http in","z":"ddf70b09.e9b388","name":"","url":"/meraki/api/networks/:netId/devices/","method":"get","swaggerDoc":"","x":240,"y":140,"wires":[["f19da6ab.310f48"]]},{"id":"9ec7006b.c0899","type":"debug","z":"ddf70b09.e9b388","name":"List Devices","active":true,"console":"false","complete":"payload","x":1150,"y":140,"wires":[]},{"id":"81f3bae1.7b32a8","type":"http response","z":"ddf70b09.e9b388","name":"","x":1170,"y":100,"wires":[]},{"id":"ae06b8a.0968448","type":"inject","z":"ddf70b09.e9b388","name":"List a single Device","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":170,"y":200,"wires":[["817335d2.ac5918"]]},{"id":"817335d2.ac5918","type":"function","z":"ddf70b09.e9b388","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\n// Sample Data\nmsg.req.params.serial = global.get('serial');\nmsg.payload = {\n    \n};\n\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":200,"wires":[["db0a8136.60e84"]]},{"id":"db0a8136.60e84","type":"function","z":"ddf70b09.e9b388","name":"Meraki API - List a Single Device","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\nvar serial = msg.req.params.serial;\n\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/devices/\"+flow.get('serial');\nmsg.method ='get';\nreturn msg;","outputs":1,"noerr":0,"x":680,"y":200,"wires":[["ff5c3546.e506d8"]]},{"id":"ff5c3546.e506d8","type":"http request","z":"ddf70b09.e9b388","name":"","method":"use","ret":"obj","url":"","tls":"","x":1010,"y":200,"wires":[["15d7dad.3199325","ba8ed237.455df"]]},{"id":"2fb431ee.0d366e","type":"http in","z":"ddf70b09.e9b388","name":"","url":"/meraki/api/networks/:netId/devices/:serial","method":"get","swaggerDoc":"","x":260,"y":240,"wires":[["db0a8136.60e84"]]},{"id":"15d7dad.3199325","type":"debug","z":"ddf70b09.e9b388","name":"List a single Device","active":true,"console":"false","complete":"true","x":1090,"y":240,"wires":[]},{"id":"ba8ed237.455df","type":"http response","z":"ddf70b09.e9b388","name":"","x":1170,"y":200,"wires":[]},{"id":"3451f136.ffec0e","type":"inject","z":"ddf70b09.e9b388","name":"Claim a Device","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":160,"y":300,"wires":[["92463257.6c1c2"]]},{"id":"92463257.6c1c2","type":"function","z":"ddf70b09.e9b388","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\n\n// Sample Data\nmsg.payload = {\n    \"serial\": global.get('serial')\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":300,"wires":[["8528adec.5bdfe"]]},{"id":"8528adec.5bdfe","type":"function","z":"ddf70b09.e9b388","name":"Meraki API - Claim a Device","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\n\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/devices/claim\";\n\nmsg.method = \"post\";\n\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":300,"wires":[["9c0d18c5.22dab8"]]},{"id":"9c0d18c5.22dab8","type":"http request","z":"ddf70b09.e9b388","name":"","method":"use","ret":"obj","url":"","tls":"","x":1010,"y":300,"wires":[["11f8d13c.c99b4f","9e87333e.8bbe3"]]},{"id":"105f500a.136ab","type":"http in","z":"ddf70b09.e9b388","name":"","url":"/meraki/api/networks/:netId/devices/claim","method":"post","swaggerDoc":"","x":260,"y":340,"wires":[["8528adec.5bdfe"]]},{"id":"11f8d13c.c99b4f","type":"debug","z":"ddf70b09.e9b388","name":"Claim a Device","active":true,"console":"false","complete":"true","x":1140,"y":340,"wires":[]},{"id":"9e87333e.8bbe3","type":"http response","z":"ddf70b09.e9b388","name":"","x":1170,"y":300,"wires":[]},{"id":"4bc22786.dffb58","type":"inject","z":"ddf70b09.e9b388","name":"Update Attributes of a Device","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":200,"y":400,"wires":[["fea9dd25.77974"]]},{"id":"fea9dd25.77974","type":"function","z":"ddf70b09.e9b388","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\n// Sample Data\nmsg.req.params.serial = global.get('serial');\nmsg.payload = {\n  \"name\":\"My device 7\",\n  \"lat\":37.4180951010362,\n  \"lng\":-122.098531723022,\n  \"address\":\"1600 Pennsylvania Ave\",\n  \"tags\":\"testAPI anotherTag\"\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":400,"wires":[["6a8c1292.303e0c"]]},{"id":"6a8c1292.303e0c","type":"function","z":"ddf70b09.e9b388","name":"Meraki API - Update Attributes of a Device","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\nvar serial = msg.req.params.serial;\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/devices/\"+serial;\nmsg.method = \"put\";\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":400,"wires":[["89f80fc5.eb72f"]]},{"id":"89f80fc5.eb72f","type":"http request","z":"ddf70b09.e9b388","name":"","method":"use","ret":"obj","url":"","tls":"","x":990,"y":400,"wires":[["d13e048.3f2a9f8","ca2001dc.67679"]]},{"id":"3558733d.436f7c","type":"http in","z":"ddf70b09.e9b388","name":"","url":"/meraki/api/networks/:netId/devices/:serial","method":"put","swaggerDoc":"","x":263.3333282470703,"y":445.00004482269287,"wires":[["6a8c1292.303e0c"]]},{"id":"d13e048.3f2a9f8","type":"debug","z":"ddf70b09.e9b388","name":"Update Attributes of a Device","active":true,"console":"false","complete":"true","x":1090,"y":440,"wires":[]},{"id":"ca2001dc.67679","type":"http response","z":"ddf70b09.e9b388","name":"","x":1170,"y":400,"wires":[]},{"id":"f1513c66.11039","type":"inject","z":"f295fd89.8ae63","name":"List SSIDs of a Network","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":180,"y":160,"wires":[["7fa73186.b0021"]]},{"id":"7fa73186.b0021","type":"function","z":"f295fd89.8ae63","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":160,"wires":[["5fe06458.53262c"]]},{"id":"5fe06458.53262c","type":"function","z":"f295fd89.8ae63","name":"Meraki API - List SSIDs of a Network","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar netId = msg.req.params.netId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/networks/\"+netId+\"/ssids\";\nmsg.method = 'get';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":160,"wires":[["2a3e79ea.fc4a36"]]},{"id":"2a3e79ea.fc4a36","type":"http request","z":"f295fd89.8ae63","name":"","method":"use","ret":"obj","url":"","tls":"","x":1010,"y":160,"wires":[["c12a70d2.7781a","1d194c2c.5363d4"]]},{"id":"90d8d996.0b3fb8","type":"http in","z":"f295fd89.8ae63","name":"[get] /meraki/api/networks/:netId/ssids","url":"/meraki/api/networks/:netId/ssids","method":"get","swaggerDoc":"","x":230,"y":200,"wires":[["5fe06458.53262c"]]},{"id":"c12a70d2.7781a","type":"debug","z":"f295fd89.8ae63","name":"List SSIDs","active":true,"console":"false","complete":"true","x":1150,"y":200,"wires":[]},{"id":"1d194c2c.5363d4","type":"http response","z":"f295fd89.8ae63","name":"","x":1170,"y":160,"wires":[]},{"id":"1ef30991.716ce6","type":"inject","z":"f295fd89.8ae63","name":"Update the Attributes of an SSID","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":210,"y":300,"wires":[["fec27fc4.42cd9"]]},{"id":"fec27fc4.42cd9","type":"function","z":"f295fd89.8ae63","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\nmsg.req.params.ssidNum = global.get('ssidNum');\n\n// Sample data\nmsg.payload = {\n  \"name\":\"new SSID name\",\n  \"enabled\":true,\n  \"authMode\":\"psk\",\n  \"encryptionMode\":\"wpa\",\n  \"psk\":\"abcd1234\",\n  \"splashPage\":\"Click-through splash page\",\n  \"perClientBandwidthLimitUp\":0,\n  \"perClientBandwidthLimitDown\":0,\n  \"ssidAdminAccessible\":false,\n  \"ipAssignmentMode\":\"Bridge mode\",\n  \"walledGardenEnabled\":true,\n  \"walledGardenRanges\":\"192.168.1.1/24 192.168.37.10/32\"\n};\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":299.99998664855957,"wires":[["e6443f09.6338b"]]},{"id":"e6443f09.6338b","type":"function","z":"f295fd89.8ae63","name":"Meraki API - Update the Attributes of an SSID","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar netId = global.get('netId');\nvar shard = global.get('shard');\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/ssids/\"+ssidNum;\nmsg.method = \"put\";\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":300,"wires":[["3a41615d.d9279e"]]},{"id":"3a41615d.d9279e","type":"http request","z":"f295fd89.8ae63","name":"","method":"use","ret":"obj","url":"","tls":"","x":1010,"y":300,"wires":[["3f1e76c5.b9b4ca","43d6245b.67848c"]]},{"id":"57792012.fe298","type":"http in","z":"f295fd89.8ae63","name":"","url":"/meraki/api/networks/:netId/ssids/:ssidNum","method":"put","swaggerDoc":"","x":260,"y":340,"wires":[["e6443f09.6338b"]]},{"id":"3f1e76c5.b9b4ca","type":"debug","z":"f295fd89.8ae63","name":"Update Attributes of an SSID","active":true,"console":"false","complete":"true","x":1100,"y":340,"wires":[]},{"id":"43d6245b.67848c","type":"http response","z":"f295fd89.8ae63","name":"","x":1170,"y":300,"wires":[]},{"id":"c19daf8a.312a","type":"inject","z":"8fb42dac.3089d","name":"List Inventory","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":110,"y":320,"wires":[["79a6bf6.23cba4"]]},{"id":"79a6bf6.23cba4","type":"function","z":"8fb42dac.3089d","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.orgId = global.get('orgId');\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":320,"wires":[["7dee1a74.fbdde4"]]},{"id":"7dee1a74.fbdde4","type":"function","z":"8fb42dac.3089d","name":"Meraki API - List Inventory","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar orgId = msg.req.params.orgId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/organizations/\"+orgId+\"/inventory\";\nmsg.method = 'get';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":320,"wires":[["aa52b98c.279c28"]]},{"id":"aa52b98c.279c28","type":"http request","z":"8fb42dac.3089d","name":"","method":"use","ret":"obj","url":"","tls":"","x":970,"y":320,"wires":[["fa8fe470.97e408","a45d080b.a78838"]]},{"id":"52903166.139dc","type":"http in","z":"8fb42dac.3089d","name":"","url":"/meraki/api/organizations/:orgId/inventory","method":"get","swaggerDoc":"","x":220,"y":360,"wires":[["7dee1a74.fbdde4"]]},{"id":"fa8fe470.97e408","type":"debug","z":"8fb42dac.3089d","name":"List Inventory","active":true,"console":"false","complete":"true","x":1100,"y":360,"wires":[]},{"id":"a45d080b.a78838","type":"http response","z":"8fb42dac.3089d","name":"","x":1130,"y":320,"wires":[]},{"id":"89ba3fc5.5561c","type":"inject","z":"6e7f14f8.00b1fc","name":"List Admins","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":110,"y":60,"wires":[["d02c4223.d8ee2"]]},{"id":"d02c4223.d8ee2","type":"function","z":"6e7f14f8.00b1fc","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.orgId = global.get('orgId');\n\n// Sample Data\nmsg.payload = {\n    \n};\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":60,"wires":[["6d26e4b8.14078c"]]},{"id":"6d26e4b8.14078c","type":"function","z":"6e7f14f8.00b1fc","name":"Meraki API - List Admins","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar orgId = msg.req.params.orgId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/organizations/\"+orgId+\"/admins\";\nmsg.method = 'get';\nreturn msg;","outputs":1,"noerr":0,"x":610,"y":60,"wires":[["63758a72.0615a4"]]},{"id":"63758a72.0615a4","type":"http request","z":"6e7f14f8.00b1fc","name":"","method":"use","ret":"obj","url":"","tls":"","x":970,"y":60,"wires":[["ca39e534.7d2758","415ae4e1.c930fc"]]},{"id":"96f0083d.805518","type":"http in","z":"6e7f14f8.00b1fc","name":"","url":"/meraki/api/organizations/:orgId/admins","method":"get","swaggerDoc":"","x":210,"y":100,"wires":[["6d26e4b8.14078c"]]},{"id":"ca39e534.7d2758","type":"debug","z":"6e7f14f8.00b1fc","name":"List Admins","active":true,"console":"false","complete":"true","x":1110,"y":100,"wires":[]},{"id":"415ae4e1.c930fc","type":"http response","z":"6e7f14f8.00b1fc","name":"","x":1130,"y":60,"wires":[]},{"id":"b0d8ddc.f5b342","type":"inject","z":"6e7f14f8.00b1fc","name":"Create Admin","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":110,"y":180,"wires":[["64096931.b33dc8"]]},{"id":"64096931.b33dc8","type":"function","z":"6e7f14f8.00b1fc","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.orgId = global.get('orgId');\n\n// Sample Data\nmsg.payload = {\n    email: '[email protected]',\n    name: 'cory lego user',\n    orgAccess: 'read-only',\n    tags:[\n        {\n            \"tag\":\"west\",\n            \"access\":\"read-only\"\n        },\n        {\n            \"tag\":\"east\",\n            \"access\":\"read-only\"\n        }\n    ],\n    networks: [] \n};\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":180,"wires":[["f2986e49.69308"]]},{"id":"f2986e49.69308","type":"function","z":"6e7f14f8.00b1fc","name":"Meraki API - Create Admin","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar orgId = msg.req.params.orgId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/organizations/\"+orgId+\"/admins\";\nmsg.method = 'post';\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":180,"wires":[["41d9e859.59f4f8"]]},{"id":"41d9e859.59f4f8","type":"http request","z":"6e7f14f8.00b1fc","name":"","method":"use","ret":"obj","url":"","tls":"","x":970,"y":180,"wires":[["eeb89117.131ee","33c30ff3.dda7b"]]},{"id":"c037291a.5b08d8","type":"http in","z":"6e7f14f8.00b1fc","name":"","url":"/meraki/api/organizations/:orgId/admins","method":"post","swaggerDoc":"","x":210,"y":220,"wires":[["f2986e49.69308"]]},{"id":"eeb89117.131ee","type":"debug","z":"6e7f14f8.00b1fc","name":"Create Admin","active":true,"console":"false","complete":"payload","x":1100,"y":220,"wires":[]},{"id":"33c30ff3.dda7b","type":"http response","z":"6e7f14f8.00b1fc","name":"","x":1130,"y":180,"wires":[]},{"id":"ecde1563.36ba68","type":"inject","z":"ddf70b09.e9b388","name":"Uplink Status of a Device","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":190,"y":680,"wires":[["f02b616f.cfe9f"]]},{"id":"f02b616f.cfe9f","type":"function","z":"ddf70b09.e9b388","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\nmsg.req.params.serial = global.get('serial');\n\n// Sample Data\nmsg.payload = {\n    \n};\n\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":680,"wires":[["f9fbc5e8.8ca6b8"]]},{"id":"f9fbc5e8.8ca6b8","type":"function","z":"ddf70b09.e9b388","name":"Meraki API - Uplink Status","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\nvar serial = msg.req.params.serial;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/networks/\"+netId+\"/devices/\"+serial+\"/uplink\";\nmsg.method = \"get\";\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":680,"wires":[["f95b45ea.ff8278"]]},{"id":"f95b45ea.ff8278","type":"http request","z":"ddf70b09.e9b388","name":"","method":"use","ret":"obj","url":"","tls":"","x":1010,"y":680,"wires":[["af6d1890.73b458","690e15f4.2fff0c"]]},{"id":"4e1b77a8.8f90c8","type":"http in","z":"ddf70b09.e9b388","name":"","url":"meraki/api/networks/:netId/devices/:serial/uplink","method":"get","swaggerDoc":"","x":280,"y":720,"wires":[["f9fbc5e8.8ca6b8"]]},{"id":"af6d1890.73b458","type":"debug","z":"ddf70b09.e9b388","name":"Uplink Status","active":true,"console":"false","complete":"true","x":1140,"y":720,"wires":[]},{"id":"690e15f4.2fff0c","type":"http response","z":"ddf70b09.e9b388","name":"","x":1170,"y":680,"wires":[]},{"id":"93ff7faf.c764e","type":"inject","z":"9696e4c4.ac1b68","name":"Traffic Analysis","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":560,"wires":[["fca1449c.f4a4a8"]]},{"id":"fca1449c.f4a4a8","type":"function","z":"9696e4c4.ac1b68","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\n\n// Sample Data\nmsg.payload = {\n\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":560,"wires":[["cce7093c.cfd918"]]},{"id":"cce7093c.cfd918","type":"function","z":"9696e4c4.ac1b68","name":"Meraki API - Traffic Analysis","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/networks/\"+netId+\"/traffic?timespan=14400\";\nmsg.method = \"get\";\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":560,"wires":[["4af3caeb.0ddeb4"]]},{"id":"4af3caeb.0ddeb4","type":"http request","z":"9696e4c4.ac1b68","name":"","method":"use","ret":"obj","url":"","tls":"","x":970,"y":560,"wires":[["5266be13.58245","dc239783.df8298"]]},{"id":"35c2e76b.6902c8","type":"http in","z":"9696e4c4.ac1b68","name":"","url":"/meraki/api/networks/:netId/traffic?timespan=14400","method":"get","swaggerDoc":"","x":250,"y":600,"wires":[["cce7093c.cfd918"]]},{"id":"5266be13.58245","type":"debug","z":"9696e4c4.ac1b68","name":"Traffic Analysis","active":true,"console":"false","complete":"true","x":1100,"y":600,"wires":[]},{"id":"dc239783.df8298","type":"http response","z":"9696e4c4.ac1b68","name":"","x":1130,"y":560,"wires":[]},{"id":"48847b7f.f519a4","type":"inject","z":"84a99143.8865e","name":"Sets Defaults - Injected at start","topic":"","payload":"Setting Environment Variables","payloadType":"str","repeat":"","crontab":"","once":true,"x":190,"y":80,"wires":[["cb53383e.754b58"]]},{"id":"cb53383e.754b58","type":"function","z":"84a99143.8865e","name":"Set Environment Variables: UPDATE THIS","func":"//  ###### User Defined Variables ######\n\nconst API_KEY = 'YoUr ApI KEy'; //Your API KEY (Keep this secret. Do not publish)\n\nvar shard = 'dashboard'; // https://n149.meraki.com , where n149 represent the shard number. This is defined to avoid redirect issues.\n\n\n// These environment variables are used by the testing buttons. In production, these paramters should be passed in the URL.\nvar orgId = '123123123'; // Your test Organization ID\nvar netId = 'N_123123123123'; // Your test Network ID\nvar netId_delete = \"L_123123123123\"; // some test network to delete as a test. Be carefull!\nvar serial = '1234-1234-1234'; // Your test serial numer of device\nvar ssidNum = '0';\n// ###### ###### ###### ###### ###### ######\n\n\n\n\n\n// Assign to Flow Context \nglobal.set('apiKey', API_KEY); \nglobal.set('orgId', orgId);\nglobal.set('netId', netId);\nglobal.set('serial', serial);\nglobal.set('shard', shard);\nglobal.set('netId_delete', netId_delete);\n\n// confirm changes were made\nvar settings = {};\n\n\nsettings.apiKey = global.get('apiKey');\nsettings.orgId = global.get('orgId');\nsettings.netId = global.get('netId');\nsettings.serial = global.get('serial');\nsettings.shard = global.get('shard');\n\nmsg.payload = settings;\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":80,"wires":[["b2e100a0.bd2cf"]]},{"id":"b2e100a0.bd2cf","type":"debug","z":"84a99143.8865e","name":"Flow Env Variables","active":true,"console":"false","complete":"true","x":970,"y":80,"wires":[]},{"id":"67096d0b.515964","type":"comment","z":"84a99143.8865e","name":"API Key and Environment variables: UPDATE THE NODE!","info":"","x":230,"y":40,"wires":[]},{"id":"ca12baf8.6ae168","type":"inject","z":"ba9e2568.77a458","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":540,"wires":[["a01f1a57.d34b48"]]},{"id":"a01f1a57.d34b48","type":"function","z":"ba9e2568.77a458","name":"loop 10 times","func":"for(var x =0; x<10; x++){\n    msg.payload = x;\n    node.send(msg);\n}\n","outputs":1,"noerr":0,"x":310,"y":540,"wires":[["cb7aaf9d.76523"]]},{"id":"cb7aaf9d.76523","type":"debug","z":"ba9e2568.77a458","name":"","active":true,"console":"false","complete":"false","x":510,"y":540,"wires":[]},{"id":"6c1b707a.ec504","type":"inject","z":"ba9e2568.77a458","name":"List Devices","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":110,"y":140,"wires":[["f9e781ae.0cee9"]]},{"id":"f9e781ae.0cee9","type":"function","z":"ba9e2568.77a458","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\n\n// Sample Data\nmsg.payload = {\n\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":140,"wires":[["91a213fa.d6f6b"]]},{"id":"91a213fa.d6f6b","type":"function","z":"ba9e2568.77a458","name":"Meraki API - List Devices","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/networks/\"+netId+\"/devices/\";\nmsg.method = \"get\";\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":140,"wires":[["3e5a246d.8e732c"]]},{"id":"3e5a246d.8e732c","type":"http request","z":"ba9e2568.77a458","name":"","method":"use","ret":"obj","url":"","tls":"","x":890,"y":140,"wires":[["82438b50.517608","5ced51b5.8698a"]]},{"id":"82438b50.517608","type":"debug","z":"ba9e2568.77a458","name":"List Devices","active":true,"console":"false","complete":"true","x":890,"y":180,"wires":[]},{"id":"5ced51b5.8698a","type":"function","z":"ba9e2568.77a458","name":"Send each serial","func":"var devices = msg.payload;\nmsg.count = devices.length; // used for later context function\nfor(var x = 0; x < devices.length; x++){\n    msg.serial = devices[x].serial;\n    msg.netId = devices[x].networkId;\n    node.send(msg)\n}\n","outputs":1,"noerr":0,"x":270,"y":220,"wires":[["42a7767b.db2f88","34d69aa4.6aa916"]]},{"id":"34d69aa4.6aa916","type":"function","z":"ba9e2568.77a458","name":"Meraki API - Uplink Status","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.netId;\nvar serial = msg.serial;\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/networks/\"+netId+\"/devices/\"+serial+\"/uplink\";\nmsg.method = \"get\";\nreturn msg;","outputs":1,"noerr":0,"x":520,"y":220,"wires":[["a948a8cc.67b458"]]},{"id":"522af1f0.d7206","type":"http request","z":"ba9e2568.77a458","name":"","method":"use","ret":"obj","url":"","tls":"","x":890,"y":220,"wires":[["3bbb4e57.5b63e2","66b2c426.05b90c"]]},{"id":"3bbb4e57.5b63e2","type":"debug","z":"ba9e2568.77a458","name":"Uplink Status","active":true,"console":"false","complete":"payload","x":900,"y":260,"wires":[]},{"id":"42a7767b.db2f88","type":"debug","z":"ba9e2568.77a458","name":"Send each serial","active":false,"console":"false","complete":"true","x":290,"y":260,"wires":[]},{"id":"a948a8cc.67b458","type":"delay","z":"ba9e2568.77a458","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":730,"y":220,"wires":[["522af1f0.d7206"]]},{"id":"aa991f82.51d7f","type":"comment","z":"ba9e2568.77a458","name":"Uplink status for each device","info":"","x":160,"y":180,"wires":[]},{"id":"41bad26.e80a22c","type":"http in","z":"ba9e2568.77a458","name":"","url":"/meraki/api/networks/:netId/devicesUplinks","method":"get","swaggerDoc":"","x":220,"y":100,"wires":[["91a213fa.d6f6b"]]},{"id":"5620c409.5d867c","type":"http response","z":"ba9e2568.77a458","name":"http response to client API","x":880,"y":300,"wires":[]},{"id":"ddbe1088.ae6fa","type":"comment","z":"ba9e2568.77a458","name":"Sample Logic","info":"","x":110,"y":500,"wires":[]},{"id":"66b2c426.05b90c","type":"function","z":"ba9e2568.77a458","name":"Context Buffer","func":"var dataBuffer = context.get('dataBuffer') || [];\ndataBuffer.push(msg.payload);\nconsole.log(\"dataBuffer\",dataBuffer);\nif (dataBuffer.length == msg.count){\n    msg.payload = dataBuffer;\n    // clear dataBuffer\n    dataBuffer = [];\n    context.set('dataBuffer',dataBuffer);\n    \n    // send final payload\n    return msg;\n}else{\n    context.set('dataBuffer',dataBuffer);\n    // do nothing and wait for more data\n}\n","outputs":1,"noerr":0,"x":640,"y":300,"wires":[["5620c409.5d867c","28816084.00b29"]]},{"id":"28816084.00b29","type":"debug","z":"ba9e2568.77a458","name":"Uplink Status context","active":true,"console":"false","complete":"true","x":860,"y":340,"wires":[]},{"id":"f9e4030e.b2025","type":"comment","z":"ba9e2568.77a458","name":"Get all device uplink status by iterating through each device and querying its status. Warning: this process does take a while.","info":"","x":540,"y":60,"wires":[]},{"id":"b25f1ba6.71ca08","type":"inject","z":"aee95c7f.b5f35","name":"List Clients","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":80,"wires":[["fc8df44a.ed2dd8"]]},{"id":"fc8df44a.ed2dd8","type":"function","z":"aee95c7f.b5f35","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.serial = global.get('serial');\n\n// Sample Data\nmsg.req.query = \"timespan=84000\";\nmsg.payload = {\n\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":80,"wires":[["d24b28e8.1bec88"]]},{"id":"d24b28e8.1bec88","type":"function","z":"aee95c7f.b5f35","name":"Meraki API - List Clients","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar serial = msg.req.params.serial;\nvar query = msg.req.query;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/devices/\"+serial+\"/clients?\"+query;\nmsg.method = \"get\";\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":80,"wires":[["b73105f1.8971d8"]]},{"id":"b73105f1.8971d8","type":"http request","z":"aee95c7f.b5f35","name":"","method":"use","ret":"obj","url":"","tls":"","x":990,"y":80,"wires":[["f642e454.2ad638","7d9e31ea.94ed9"]]},{"id":"81ff2bc2.0fd3f8","type":"http in","z":"aee95c7f.b5f35","name":"","url":"/meraki/api/devices/:serial/clients","method":"get","swaggerDoc":"","x":210,"y":120,"wires":[["d24b28e8.1bec88"]]},{"id":"f642e454.2ad638","type":"debug","z":"aee95c7f.b5f35","name":"List Clients","active":true,"console":"false","complete":"payload","x":1130,"y":120,"wires":[]},{"id":"7d9e31ea.94ed9","type":"http response","z":"aee95c7f.b5f35","name":"","x":1150,"y":80,"wires":[]},{"id":"782ed88c.25aac8","type":"inject","z":"53741f01.0a6a","name":"List L3 Firewall Rules (MR Wireless)","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":180,"y":60,"wires":[["68fcf473.79883c"]]},{"id":"68fcf473.79883c","type":"function","z":"53741f01.0a6a","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.serial = global.get('serial');\nmsg.req.params.netId = global.get('netId');\n\n// Sample Data\nmsg.payload = {\n\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":60,"wires":[["1e3a2bdd.37e394"]]},{"id":"1e3a2bdd.37e394","type":"function","z":"53741f01.0a6a","name":"Meraki API - List L3 Firewall Rules","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar ssidNum = msg.req.params.ssidNum;\nvar netId = msg.req.params.netId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/ssids/\"+ssidNum+\"/l3FirewallRules\";\nmsg.method = \"get\";\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":60,"wires":[["3e5cef74.7c8d3"]]},{"id":"3e5cef74.7c8d3","type":"http request","z":"53741f01.0a6a","name":"","method":"use","ret":"obj","url":"","tls":"","x":970,"y":60,"wires":[["9743af0d.4a6c8","1e531152.659daf"]]},{"id":"a19bb503.f051a8","type":"http in","z":"53741f01.0a6a","name":"","url":"/meraki/api/networks/:netId/ssids/:ssidNum/l3FirewallRules","method":"get","swaggerDoc":"","x":270,"y":100,"wires":[["1e3a2bdd.37e394"]]},{"id":"9743af0d.4a6c8","type":"debug","z":"53741f01.0a6a","name":"List L3 Firewall Rules","active":true,"console":"false","complete":"payload","x":1140,"y":100,"wires":[]},{"id":"1e531152.659daf","type":"http response","z":"53741f01.0a6a","name":"","x":1130,"y":60,"wires":[]},{"id":"e838a4e6.567e78","type":"inject","z":"53741f01.0a6a","name":"Update L3 Firewall Rules (MR Wireless)","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":190,"y":180,"wires":[["9eccb79a.31a328"]]},{"id":"9eccb79a.31a328","type":"function","z":"53741f01.0a6a","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.serial = global.get('serial');\nmsg.req.params.netId = global.get('netId');\n\n// Sample Data\nmsg.payload = {\n\t\"rules\":[{\n\t\"comment\":\"API TEST from Node-RED\",\n\t\"policy\":\"deny\",\n\t\"protocol\":\"tcp\",\n\t\"destPort\":\"any\",\n\t\"destCidr\":\"192.168.1.0/24\"\n\t\n}],\n\t\"allowLanAccess\":true\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":180,"wires":[["691d9d21.81ab14"]]},{"id":"691d9d21.81ab14","type":"function","z":"53741f01.0a6a","name":"Meraki API - Update the Attributes of an SSID","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar ssidNum = msg.req.params.ssidNum;\nvar netId = msg.req.params.netId;\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/ssids/\"+ssidNum+\"/l3FirewallRules\";\nmsg.method = \"put\";\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":180,"wires":[["43f8c2e9.8b3e5c"]]},{"id":"43f8c2e9.8b3e5c","type":"http request","z":"53741f01.0a6a","name":"","method":"use","ret":"obj","url":"","tls":"","x":1010,"y":180,"wires":[["a9ee6625.5bdb58","51759f94.b6234"]]},{"id":"45618a3.d086574","type":"http in","z":"53741f01.0a6a","name":"","url":"/meraki/api/networks/:netId/ssids/:ssidNum/l3FirewallRules","method":"put","swaggerDoc":"","x":270,"y":220,"wires":[["691d9d21.81ab14"]]},{"id":"a9ee6625.5bdb58","type":"debug","z":"53741f01.0a6a","name":"Update Attributes of an SSID","active":true,"console":"false","complete":"true","x":1100,"y":220,"wires":[]},{"id":"51759f94.b6234","type":"http response","z":"53741f01.0a6a","name":"","x":1170,"y":180,"wires":[]},{"id":"4eaa1159.602b","type":"inject","z":"9696e4c4.ac1b68","name":"Delete a Network","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":360,"wires":[["f09f9dde.64aa2"]]},{"id":"f09f9dde.64aa2","type":"function","z":"9696e4c4.ac1b68","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId_delete');\n\n// Sample Data\nmsg.payload = {\n    \"name\": \"API Test - Node-RED - \"+ (new Date().getMilliseconds()),\n    \"timeZone\": \"Europe/Amsterdam\",\n    \"tags\": \"APItest\",\n    \"type\": \"wireless\"\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":360,"wires":[["7b07e18d.21847"]]},{"id":"7b07e18d.21847","type":"function","z":"9696e4c4.ac1b68","name":"Meraki API - Delete a Network","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\n\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId;\nmsg.method = 'delete';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":360,"wires":[["7c8117dc.33c388"]]},{"id":"7c8117dc.33c388","type":"http request","z":"9696e4c4.ac1b68","name":"","method":"use","ret":"obj","url":"","tls":"","x":970,"y":360,"wires":[["6535e0cd.056d7","66fd4478.0d7d8c"]]},{"id":"3d190063.9c71a","type":"http in","z":"9696e4c4.ac1b68","name":"","url":"meraki/api/networks/:netId","method":"delete","swaggerDoc":"","x":180,"y":400,"wires":[["7b07e18d.21847"]]},{"id":"6535e0cd.056d7","type":"debug","z":"9696e4c4.ac1b68","name":"Delete a Network","active":true,"console":"false","complete":"true","x":1090,"y":400,"wires":[]},{"id":"66fd4478.0d7d8c","type":"http response","z":"9696e4c4.ac1b68","name":"","x":1130,"y":360,"wires":[]},{"id":"73fb358b.a61f8c","type":"inject","z":"1cb3e834.2a9958","name":"List VPN Settings","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":80,"wires":[["772ee4b1.3caf2c"]]},{"id":"772ee4b1.3caf2c","type":"function","z":"1cb3e834.2a9958","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":80,"wires":[["2d2f5d8f.a02052"]]},{"id":"2d2f5d8f.a02052","type":"function","z":"1cb3e834.2a9958","name":"Meraki API - List VPN Settings","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar netId = msg.req.params.netId;\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://dashboard.meraki.com/api/v0/networks/\"+netId+\"/siteToSiteVpn\";\nmsg.method = 'get';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":80,"wires":[["970b1549.1dece8"]]},{"id":"970b1549.1dece8","type":"http request","z":"1cb3e834.2a9958","name":"","method":"use","ret":"obj","url":"","tls":"","x":990,"y":80,"wires":[["1040e78.160f419","72cc5069.8c8c4"]]},{"id":"56d905f0.a1073c","type":"http in","z":"1cb3e834.2a9958","name":"","url":"/meraki/api/networks/:netId/siteToSiteVpn","method":"get","swaggerDoc":"","x":240,"y":120,"wires":[["2d2f5d8f.a02052"]]},{"id":"1040e78.160f419","type":"debug","z":"1cb3e834.2a9958","name":"VPN Settings","active":true,"console":"false","complete":"true","x":1150,"y":120,"wires":[]},{"id":"72cc5069.8c8c4","type":"http response","z":"1cb3e834.2a9958","name":"","x":1150,"y":80,"wires":[]},{"id":"a58643cd.216e1","type":"inject","z":"1cb3e834.2a9958","name":"Update VPN Settings","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":160,"y":200,"wires":[["f1534c22.2ece4"]]},{"id":"f1534c22.2ece4","type":"function","z":"1cb3e834.2a9958","name":"test params","func":"msg.req = {};\nmsg.req.params = {};\nmsg.req.params.netId = global.get('netId');\n\n// Sample Data\nmsg.payload = {\n\"mode\":\"spoke\",\n\"hubs\":[{\n\t\"hubId\":\"N_1234\",\n\t\"useDefaultRoute\":true\n\t},\n\t{\n\t\t\"hubId\":\"N_2345\",\"useDefaultRoute\":false\n\t}],\n\t\"subnets\":[{\n\t\t\"localSubnet\":\"192.168.1.0/24\",\n\t\t\"useVpn\":true\n\t},\n\t{\"localSubnet\":\"192.168.128.0/24\",\n\t\"useVpn\":true\n\t\t\n\t}]\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":200,"wires":[["40406a0b.631714"]]},{"id":"40406a0b.631714","type":"function","z":"1cb3e834.2a9958","name":"Meraki API - List VPN Settings","func":"// Set Variables\nvar apiKey = global.get('apiKey');\nvar shard = global.get('shard');\nvar netId = msg.req.params.netId;\n\n\n// API Call\nmsg.headers = {\n    \"X-Cisco-Meraki-API-Key\": apiKey\n};\nmsg.url = \"https://\"+shard+\".meraki.com/api/v0/networks/\"+netId+\"/siteToSiteVpn\";\nmsg.method = 'get';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":200,"wires":[["d72f5ce6.905c1"]]},{"id":"d72f5ce6.905c1","type":"http request","z":"1cb3e834.2a9958","name":"","method":"use","ret":"obj","url":"","tls":"","x":990,"y":200,"wires":[["8bf457d9.454668","c212c088.4c70e"]]},{"id":"72a99964.d37ac8","type":"http in","z":"1cb3e834.2a9958","name":"","url":"/meraki/api/networks/:netId/siteToSiteVpn","method":"put","swaggerDoc":"","x":240,"y":240,"wires":[["40406a0b.631714"]]},{"id":"8bf457d9.454668","type":"debug","z":"1cb3e834.2a9958","name":"VPN Settings","active":true,"console":"false","complete":"true","x":1150,"y":240,"wires":[]},{"id":"c212c088.4c70e","type":"http response","z":"1cb3e834.2a9958","name":"","x":1150,"y":200,"wires":[]}]
dexterlabora

Flow Info

created 3 months ago
updated 2 months, 3 weeks ago

Node Types

Core
  • comment (x5)
  • debug (x31)
  • delay (x1)
  • function (x57)
  • http in (x26)
  • http request (x27)
  • http response (x26)
  • inject (x28)
  • json (x1)
Other
  • tab (x18)

Tags

  • cisco
  • meraki
  • api
  • dashboard
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option