Last active
July 12, 2017 21:21
-
-
Save dexterlabora/0f0683ab4d30462514a00555e76b9a51 to your computer and use it in GitHub Desktop.
Meraki CMX Location Scanning API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "ab588013.cfa1f", | |
"type": "comment", | |
"z": "3e08f755.c41b78", | |
"name": "Meraki Location Scanning API - Native Receiver README", | |
"info": "This flow demonstrates the core mechanics of the\nMeraki Scanning API.\n\nLocation observation data is sent periodically from\nthe Meraki Dashboard. \n\n\n# Setup\n*Configure Meraki Network*\n- In the Meraki Dashboard, add a Post URL pointing to this server\n`http://yourserver:1880/scanningNative`\n* note your validator key provided and define your secret\n\n*Validator*\n- Update the function node with your validator key\n\n*Secret*\n- Update the switch node with your secret\n\n\n# How it works\n\n\nMeraki must first perform a GET request, in which\nit expects a response string that is the Validator\ndefined in the Meraki Dashboard (Network-wide settings)\n\nOnce validated, Meraki will periodically send\nPOSTs. This array of objects should contain a \nsecret that was defined on the Meraki Dashboard.\nThis flow will check for the secret to redirect the \ndata flow.", | |
"x": 381.5, | |
"y": 82, | |
"wires": [] | |
}, | |
{ | |
"id": "4803edf9.f2ae24", | |
"type": "debug", | |
"z": "3e08f755.c41b78", | |
"name": "Data", | |
"active": true, | |
"console": "false", | |
"complete": "true", | |
"x": 614, | |
"y": 336, | |
"wires": [] | |
}, | |
{ | |
"id": "9382050a.da7478", | |
"type": "http in", | |
"z": "3e08f755.c41b78", | |
"name": "[get] /scanningNative", | |
"url": "/scanningNative", | |
"method": "get", | |
"upload": false, | |
"swaggerDoc": "", | |
"x": 164, | |
"y": 196, | |
"wires": [ | |
[ | |
"a52d073.d4f42f8", | |
"1b0c268c.480429" | |
] | |
] | |
}, | |
{ | |
"id": "a52d073.d4f42f8", | |
"type": "function", | |
"z": "3e08f755.c41b78", | |
"name": "validate-validator - UPDATE", | |
"func": "// This node accepts a message with the validator defined in the URL\n// Example: http://yourserver:1880/cmx?validator=8e0846499d9a3f6d23f7868c4d55b9d6325035f5\n// By default, all API requests are accepted (for testing purposes)\n//~~~~~~~~~\n//validator = msg.payload.validator;\n\n\n\n//Alternatively, set the validator variable to match the Meraki network\n//The URL will not need to include the validator string, for enhanced security\n//~~~~~~~~~\nvalidator = \"YOURVALIDATORKEY\";\n\n\nmsg.payload = validator;\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 405, | |
"y": 196, | |
"wires": [ | |
[ | |
"62ecc011.5bc5e", | |
"5f07d330.a04b8c" | |
] | |
] | |
}, | |
{ | |
"id": "62ecc011.5bc5e", | |
"type": "http response", | |
"z": "3e08f755.c41b78", | |
"name": "cmx response", | |
"x": 624, | |
"y": 196, | |
"wires": [] | |
}, | |
{ | |
"id": "1b0c268c.480429", | |
"type": "debug", | |
"z": "3e08f755.c41b78", | |
"name": "validator raw", | |
"active": true, | |
"console": "false", | |
"complete": "payload", | |
"x": 334, | |
"y": 236, | |
"wires": [] | |
}, | |
{ | |
"id": "70f2533d.56572c", | |
"type": "comment", | |
"z": "3e08f755.c41b78", | |
"name": "Location API core mechanics", | |
"info": "CMX/Location API core functions", | |
"x": 164, | |
"y": 156, | |
"wires": [] | |
}, | |
{ | |
"id": "5f07d330.a04b8c", | |
"type": "debug", | |
"z": "3e08f755.c41b78", | |
"name": "Validator", | |
"active": true, | |
"console": "false", | |
"complete": "payload", | |
"x": 604, | |
"y": 236, | |
"wires": [] | |
}, | |
{ | |
"id": "5bed4c7f.fa2794", | |
"type": "comment", | |
"z": "3e08f755.c41b78", | |
"name": "Connect workflow", | |
"info": "", | |
"x": 694, | |
"y": 376, | |
"wires": [] | |
}, | |
{ | |
"id": "d8b5ecf4.017cb", | |
"type": "debug", | |
"z": "3e08f755.c41b78", | |
"name": "Location post", | |
"active": false, | |
"console": "false", | |
"complete": "payload", | |
"x": 165, | |
"y": 366, | |
"wires": [] | |
}, | |
{ | |
"id": "1c7d4339.673d9d", | |
"type": "http response", | |
"z": "3e08f755.c41b78", | |
"name": "cmx response Success", | |
"statusCode": "200", | |
"headers": {}, | |
"x": 654, | |
"y": 296, | |
"wires": [] | |
}, | |
{ | |
"id": "d5dc0d55.25421", | |
"type": "link out", | |
"z": "3e08f755.c41b78", | |
"name": "Location API All Data", | |
"links": [ | |
"86b0864b.c81758" | |
], | |
"x": 579, | |
"y": 376, | |
"wires": [] | |
}, | |
{ | |
"id": "2beb00e3.c1eca", | |
"type": "http in", | |
"z": "3e08f755.c41b78", | |
"name": "", | |
"url": "/scanningNative", | |
"method": "post", | |
"upload": false, | |
"swaggerDoc": "", | |
"x": 147, | |
"y": 317, | |
"wires": [ | |
[ | |
"d8b5ecf4.017cb", | |
"3aa63878.e959f8" | |
] | |
] | |
}, | |
{ | |
"id": "3aa63878.e959f8", | |
"type": "switch", | |
"z": "3e08f755.c41b78", | |
"name": "Verify Secret: UPDATE", | |
"property": "payload.secret", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "eq", | |
"v": "UpdateThisSecret", | |
"vt": "str" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "true", | |
"outputs": 2, | |
"x": 393.5, | |
"y": 384, | |
"wires": [ | |
[ | |
"4803edf9.f2ae24", | |
"1c7d4339.673d9d", | |
"d5dc0d55.25421" | |
], | |
[ | |
"f44651b3.b3839", | |
"38341b17.f66da4" | |
] | |
] | |
}, | |
{ | |
"id": "f44651b3.b3839", | |
"type": "http response", | |
"z": "3e08f755.c41b78", | |
"name": "cmx response FAIL", | |
"statusCode": "401", | |
"headers": {}, | |
"x": 648, | |
"y": 435, | |
"wires": [] | |
}, | |
{ | |
"id": "38341b17.f66da4", | |
"type": "debug", | |
"z": "3e08f755.c41b78", | |
"name": "Data Fail", | |
"active": true, | |
"console": "false", | |
"complete": "true", | |
"x": 617, | |
"y": 478, | |
"wires": [] | |
}, | |
{ | |
"id": "86b0864b.c81758", | |
"type": "link in", | |
"z": "3e08f755.c41b78", | |
"name": "Workflow Sample", | |
"links": [ | |
"d5dc0d55.25421" | |
], | |
"x": 119.5, | |
"y": 537, | |
"wires": [ | |
[ | |
"c76c6484.5f2418" | |
] | |
] | |
}, | |
{ | |
"id": "8b7c30a7.44998", | |
"type": "debug", | |
"z": "3e08f755.c41b78", | |
"name": "Sample Workflow", | |
"active": true, | |
"console": "false", | |
"complete": "payload", | |
"x": 353.5, | |
"y": 632, | |
"wires": [] | |
}, | |
{ | |
"id": "acea64b7.5d0e58", | |
"type": "comment", | |
"z": "3e08f755.c41b78", | |
"name": "Sample Workflow - streams individual client observations ", | |
"info": "", | |
"x": 252.5, | |
"y": 493, | |
"wires": [] | |
}, | |
{ | |
"id": "148fb6a6.3557b9", | |
"type": "split", | |
"z": "3e08f755.c41b78", | |
"name": "", | |
"splt": "\\n", | |
"spltType": "str", | |
"arraySplt": 1, | |
"arraySpltType": "len", | |
"stream": false, | |
"addname": "", | |
"x": 155.5, | |
"y": 632, | |
"wires": [ | |
[ | |
"8b7c30a7.44998" | |
] | |
] | |
}, | |
{ | |
"id": "c76c6484.5f2418", | |
"type": "function", | |
"z": "3e08f755.c41b78", | |
"name": "Extract observation data per client", | |
"func": "// Flatten JSON data \n\nmsg.payload = msg.payload.data.observations;\n\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 327.5, | |
"y": 582, | |
"wires": [ | |
[ | |
"148fb6a6.3557b9" | |
] | |
] | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment