UNPKG

node-red-contrib-meraki-dashboard-api

Version:

Node-RED node for meraki-dashboard-api

924 lines (769 loc) 1.1 MB
<script type="text/javascript"> // *** DISABLES console.log *** var console = {}; console.log = function(){}; // *** RED.nodes.registerType('meraki-dashboard-api', { category: 'Cisco Meraki', color: '#67b346', defaults: { service: { value: "", type: "meraki-dashboard-api-service", required: true }, name: { value: "" }, methodGroups: [], selectedGroup: { value: "" }, selectedMethod: { value: "" }, filteredMethods: [], //: { value: "" }, currentParams: [{value: ""}], storedParams: [{value: ""}], // testing formHtml: { value: "" }, method: { value: "", required: true } }, inputs: 1, outputs: 1, icon: 'icon.png', label: function () { return this.name || "meraki-dashboard-api"; }, oneditsave: function () { console.log('oneditsave'); var node = this; // Set the default name of the Node, if not already defined console.log('this.name: ', this.name) if(!this.name){ this.name = $('#node-input-method').val() $('#node-input-name').val(this.name); } // Save the current Group and Method selector this.selectedGroup = $('#node-input-group option:selected').val() this.selectedMethod = $('#node-input-method option:selected').val() // Save form parameters node.storedParams = []; node.storedParams = [...node.storedParams, ...node.currentParams]; console.log("node.storedParams", node.storedParams); $(`#help-method-${this.selectedMethod}`).show(); // DEBUG console.log('node: (node) ', node); }, oneditprepare: function () { var node = this; //console.log("node ", node); //if(!node.methodGroups){ var methodGroups = []; // Import Swagger Spec and map to local array for advanced filtering, etc. var example = `[ { "ts": "2018-08-15T18:32:38.123Z", "zones": { "0": { "person": 0 } } } ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsLive_serial">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsLive_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsLive_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsLive_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) methodGroups.push({methodGroup:"MV Sense", methodName:"getDeviceCameraAnalyticsLive", parameters: parameters, formHtml: formHtml, example: example, summary: `Returns live state from camera of analytics zones`}); var example = `[ [ { "startTs": "2018-08-15T18:32:38.123Z", "endTs": "2018-08-15T18:33:38.123Z", "zoneId": 0, "entrances": 254, "averageCount": 5 } ] ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsOverview_serial">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsOverview_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsOverview_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsOverview_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsOverview_t0">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsOverview_t0" style="width:70%"><i class="fa fa-list"></i> <span><b>t0</b> <i>&nbspstring</i></span></label>`; formHtml += `<p>The beginning of the timespan for the data. The maximum lookback period is 365 days from today.</p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsOverview_t0" placeholder="msg.t0" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsOverview_t0Type" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "t0" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsOverview_t1">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsOverview_t1" style="width:70%"><i class="fa fa-list"></i> <span><b>t1</b> <i>&nbspstring</i></span></label>`; formHtml += `<p>The end of the timespan for the data. t1 can be a maximum of 7 days after t0.</p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsOverview_t1" placeholder="msg.t1" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsOverview_t1Type" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "t1" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsOverview_timespan">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsOverview_timespan" style="width:70%"><i class="fa fa-list"></i> <span><b>timespan</b> <i>&nbspnumber</i></span></label>`; formHtml += `<p>The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 7 days. The default is 1 hour.</p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsOverview_timespan" placeholder="msg.timespan" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsOverview_timespanType" value="number" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "timespan" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsOverview_objectType">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsOverview_objectType" style="width:70%"><i class="fa fa-list"></i> <span><b>objectType</b> <i>&nbspstring</i></span></label>`; formHtml += `<select id="node-input-getDeviceCameraAnalyticsOverview_objectType">`; formHtml += `<option value="person">person</option>`; formHtml += `<option value="vehicle">vehicle</option>`; formHtml += `</select>`; formHtml += `</div>`; parameters.push({ camelCaseName: "objectType" }) methodGroups.push({methodGroup:"MV Sense", methodName:"getDeviceCameraAnalyticsOverview", parameters: parameters, formHtml: formHtml, example: example, summary: `Returns an overview of aggregate analytics data for a timespan`}); var example = `[ [ { "startTs": "2018-08-15T18:32:38.123Z", "endTs": "2018-08-15T18:33:38.123Z", "zoneId": 0, "entrances": 10, "averageCount": 2.54 } ] ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsRecent_serial">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsRecent_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsRecent_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsRecent_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsRecent_objectType">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsRecent_objectType" style="width:70%"><i class="fa fa-list"></i> <span><b>objectType</b> <i>&nbspstring</i></span></label>`; formHtml += `<select id="node-input-getDeviceCameraAnalyticsRecent_objectType">`; formHtml += `<option value="person">person</option>`; formHtml += `<option value="vehicle">vehicle</option>`; formHtml += `</select>`; formHtml += `</div>`; parameters.push({ camelCaseName: "objectType" }) methodGroups.push({methodGroup:"MV Sense", methodName:"getDeviceCameraAnalyticsRecent", parameters: parameters, formHtml: formHtml, example: example, summary: `Returns most recent record for analytics zones`}); var example = `[ [ { "id": "0", "type": "occupancy", "label": "Full Frame", "regionOfInterest": { "x0": "0.00", "y0": "0.00", "x1": "1.00", "y1": "1.00" } } ] ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsZones_serial">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsZones_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsZones_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsZones_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) methodGroups.push({methodGroup:"MV Sense", methodName:"getDeviceCameraAnalyticsZones", parameters: parameters, formHtml: formHtml, example: example, summary: `Returns all configured analytic zones for this camera`}); var example = `[ [ { "startTs": "2018-08-15T18:32:38.123Z", "endTs": "2018-08-15T18:33:38.123Z", "entrances": 5, "averageCount": 1.5 } ] ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsZoneHistory_serial">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsZoneHistory_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsZoneHistory_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsZoneHistory_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsZoneHistory_zoneId">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsZoneHistory_zoneId" style="width:70%"><i class="fa fa-list"></i> <span><b>zoneId<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsZoneHistory_zoneId" placeholder="msg.zoneId" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsZoneHistory_zoneIdType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "zoneId" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsZoneHistory_t0">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsZoneHistory_t0" style="width:70%"><i class="fa fa-list"></i> <span><b>t0</b> <i>&nbspstring</i></span></label>`; formHtml += `<p>The beginning of the timespan for the data. The maximum lookback period is 365 days from today.</p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsZoneHistory_t0" placeholder="msg.t0" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsZoneHistory_t0Type" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "t0" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsZoneHistory_t1">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsZoneHistory_t1" style="width:70%"><i class="fa fa-list"></i> <span><b>t1</b> <i>&nbspstring</i></span></label>`; formHtml += `<p>The end of the timespan for the data. t1 can be a maximum of 14 hours after t0.</p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsZoneHistory_t1" placeholder="msg.t1" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsZoneHistory_t1Type" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "t1" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsZoneHistory_timespan">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsZoneHistory_timespan" style="width:70%"><i class="fa fa-list"></i> <span><b>timespan</b> <i>&nbspnumber</i></span></label>`; formHtml += `<p>The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 14 hours. The default is 1 hour.</p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsZoneHistory_timespan" placeholder="msg.timespan" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsZoneHistory_timespanType" value="number" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "timespan" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsZoneHistory_resolution">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsZoneHistory_resolution" style="width:70%"><i class="fa fa-list"></i> <span><b>resolution</b> <i>&nbspinteger</i></span></label>`; formHtml += `<p>The time resolution in seconds for returned data. The valid resolutions are: 60. The default is 60.</p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraAnalyticsZoneHistory_resolution" placeholder="msg.resolution" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraAnalyticsZoneHistory_resolutionType" value="integer" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "resolution" }) formHtml += `<div class="form-row" id="getDeviceCameraAnalyticsZoneHistory_objectType">`; formHtml += `<label for="node-input-getDeviceCameraAnalyticsZoneHistory_objectType" style="width:70%"><i class="fa fa-list"></i> <span><b>objectType</b> <i>&nbspstring</i></span></label>`; formHtml += `<select id="node-input-getDeviceCameraAnalyticsZoneHistory_objectType">`; formHtml += `<option value="person">person</option>`; formHtml += `<option value="vehicle">vehicle</option>`; formHtml += `</select>`; formHtml += `</div>`; parameters.push({ camelCaseName: "objectType" }) methodGroups.push({methodGroup:"MV Sense", methodName:"getDeviceCameraAnalyticsZoneHistory", parameters: parameters, formHtml: formHtml, example: example, summary: `Return historical records for analytic zones`}); var example = `[ { "motionBasedRetentionEnabled": false, "audioRecordingEnabled": false, "restrictedBandwidthModeEnabled": false, "profileId": null, "quality": "Standard", "resolution": 720 } ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceCameraQualityAndRetentionSettings_serial">`; formHtml += `<label for="node-input-getDeviceCameraQualityAndRetentionSettings_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceCameraQualityAndRetentionSettings_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCameraQualityAndRetentionSettings_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) methodGroups.push({methodGroup:"Cameras", methodName:"getDeviceCameraQualityAndRetentionSettings", parameters: parameters, formHtml: formHtml, example: example, summary: `Returns quality and retention settings for the given camera`}); var example = `[ { "motionBasedRetentionEnabled": false, "audioRecordingEnabled": false, "restrictedBandwidthModeEnabled": false, "profileId": null, "quality": "Standard", "resolution": 720 } ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="updateDeviceCameraQualityAndRetentionSettings_serial">`; formHtml += `<label for="node-input-updateDeviceCameraQualityAndRetentionSettings_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-updateDeviceCameraQualityAndRetentionSettings_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-updateDeviceCameraQualityAndRetentionSettings_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="updateDeviceCameraQualityAndRetentionSettings_updateDeviceCameraQualityAndRetentionSettings">`; formHtml += `<label for="node-input-updateDeviceCameraQualityAndRetentionSettings_updateDeviceCameraQualityAndRetentionSettings" style="width:70%"><i class="fa fa-list"></i> <span><b>updateDeviceCameraQualityAndRetentionSettings</b> <i>&nbsp</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-updateDeviceCameraQualityAndRetentionSettings_updateDeviceCameraQualityAndRetentionSettings" placeholder="msg.updateDeviceCameraQualityAndRetentionSettings" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-updateDeviceCameraQualityAndRetentionSettings_updateDeviceCameraQualityAndRetentionSettingsType" value="" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "updateDeviceCameraQualityAndRetentionSettings" }) methodGroups.push({methodGroup:"Cameras", methodName:"updateDeviceCameraQualityAndRetentionSettings", parameters: parameters, formHtml: formHtml, example: example, summary: `Update quality and retention settings for the given camera`}); var example = `[ { "deviceName": "name of the MG", "deviceLanIp": "192.168.0.33", "deviceSubnet": "192.168.0.32/27", "fixedIpAssignments": [ { "mac": "0b:00:00:00:00:ac", "name": "server 1", "ip": "192.168.0.10" }, { "mac": "0b:00:00:00:00:ab", "name": "server 2", "ip": "192.168.0.20" } ], "reservedIpRanges": [ { "start": "192.168.1.0", "end": "192.168.1.1", "comment": "A reserved IP range" } ] } ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceCellularGatewaySettings_serial">`; formHtml += `<label for="node-input-getDeviceCellularGatewaySettings_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceCellularGatewaySettings_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCellularGatewaySettings_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) methodGroups.push({methodGroup:"MG LAN settings", methodName:"getDeviceCellularGatewaySettings", parameters: parameters, formHtml: formHtml, example: example, summary: `Show the LAN Settings of a MG`}); var example = `[ { "deviceName": "name of the MG", "deviceLanIp": "192.168.0.33", "deviceSubnet": "192.168.0.32/27", "fixedIpAssignments": [ { "mac": "0b:00:00:00:00:ac", "name": "server 1", "ip": "192.168.0.10" }, { "mac": "0b:00:00:00:00:ab", "name": "server 2", "ip": "192.168.0.20" } ], "reservedIpRanges": [ { "start": "192.168.1.0", "end": "192.168.1.1", "comment": "A reserved IP range" } ] } ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="updateDeviceCellularGatewaySettings_serial">`; formHtml += `<label for="node-input-updateDeviceCellularGatewaySettings_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-updateDeviceCellularGatewaySettings_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-updateDeviceCellularGatewaySettings_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="updateDeviceCellularGatewaySettings_updateDeviceCellularGatewaySettings">`; formHtml += `<label for="node-input-updateDeviceCellularGatewaySettings_updateDeviceCellularGatewaySettings" style="width:70%"><i class="fa fa-list"></i> <span><b>updateDeviceCellularGatewaySettings</b> <i>&nbsp</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-updateDeviceCellularGatewaySettings_updateDeviceCellularGatewaySettings" placeholder="msg.updateDeviceCellularGatewaySettings" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-updateDeviceCellularGatewaySettings_updateDeviceCellularGatewaySettingsType" value="" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "updateDeviceCellularGatewaySettings" }) methodGroups.push({methodGroup:"MG LAN settings", methodName:"updateDeviceCellularGatewaySettings", parameters: parameters, formHtml: formHtml, example: example, summary: `Update the LAN Settings for a single MG.`}); var example = `[ { "rules": [ { "lanIp": "172.31.128.5", "name": "test", "access": "any", "publicPort": "11-12", "localPort": "4", "uplink": "both", "protocol": "tcp" }, { "lanIp": "172.31.128.5", "name": "test 2", "access": "restricted", "allowedIps": [ "10.10.10.10", "10.10.10.11" ], "publicPort": "99", "localPort": "5", "uplink": "both", "protocol": "tcp" } ] } ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceCellularGatewaySettingsPortForwardingRules_serial">`; formHtml += `<label for="node-input-getDeviceCellularGatewaySettingsPortForwardingRules_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceCellularGatewaySettingsPortForwardingRules_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceCellularGatewaySettingsPortForwardingRules_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) methodGroups.push({methodGroup:"MG port forwarding rules", methodName:"getDeviceCellularGatewaySettingsPortForwardingRules", parameters: parameters, formHtml: formHtml, example: example, summary: `Returns the port forwarding rules for a single MG.`}); var example = `[ { "rules": [ { "lanIp": "172.31.128.5", "name": "test", "access": "any", "publicPort": "11-12", "localPort": "4", "uplink": "both", "protocol": "tcp" }, { "lanIp": "172.31.128.5", "name": "test 2", "access": "restricted", "allowedIps": [ "10.10.10.10", "10.10.10.11" ], "publicPort": "99", "localPort": "5", "uplink": "both", "protocol": "tcp" } ] } ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="updateDeviceCellularGatewaySettingsPortForwardingRules_serial">`; formHtml += `<label for="node-input-updateDeviceCellularGatewaySettingsPortForwardingRules_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-updateDeviceCellularGatewaySettingsPortForwardingRules_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-updateDeviceCellularGatewaySettingsPortForwardingRules_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="updateDeviceCellularGatewaySettingsPortForwardingRules_updateDeviceCellularGatewaySettingsPortForwardingRules">`; formHtml += `<label for="node-input-updateDeviceCellularGatewaySettingsPortForwardingRules_updateDeviceCellularGatewaySettingsPortForwardingRules" style="width:70%"><i class="fa fa-list"></i> <span><b>updateDeviceCellularGatewaySettingsPortForwardingRules</b> <i>&nbsp</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-updateDeviceCellularGatewaySettingsPortForwardingRules_updateDeviceCellularGatewaySettingsPortForwardingRules" placeholder="msg.updateDeviceCellularGatewaySettingsPortForwardingRules" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-updateDeviceCellularGatewaySettingsPortForwardingRules_updateDeviceCellularGatewaySettingsPortForwardingRulesType" value="" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "updateDeviceCellularGatewaySettingsPortForwardingRules" }) methodGroups.push({methodGroup:"MG port forwarding rules", methodName:"updateDeviceCellularGatewaySettingsPortForwardingRules", parameters: parameters, formHtml: formHtml, example: example, summary: `Updates the port forwarding rules for a single MG.`}); var example = `[ [ { "usage": { "sent": 138, "recv": 61 }, "id": "k74272e", "description": "Miles's phone", "mac": "22:33:44:55:66:77", "ip": "1.2.3.4", "user": "milesmeraki", "vlan": 255, "switchport": null, "mdnsName": "Miles's phone", "dhcpHostname": "MilesPhone" } ] ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceClients_serial">`; formHtml += `<label for="node-input-getDeviceClients_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceClients_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceClients_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="getDeviceClients_t0">`; formHtml += `<label for="node-input-getDeviceClients_t0" style="width:70%"><i class="fa fa-list"></i> <span><b>t0</b> <i>&nbspstring</i></span></label>`; formHtml += `<p>The beginning of the timespan for the data. The maximum lookback period is 31 days from today.</p>`; formHtml += `<input type="text" id="node-input-getDeviceClients_t0" placeholder="msg.t0" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceClients_t0Type" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "t0" }) formHtml += `<div class="form-row" id="getDeviceClients_timespan">`; formHtml += `<label for="node-input-getDeviceClients_timespan" style="width:70%"><i class="fa fa-list"></i> <span><b>timespan</b> <i>&nbspnumber</i></span></label>`; formHtml += `<p>The timespan for which the information will be fetched. If specifying timespan, do not specify parameter t0. The value must be in seconds and be less than or equal to 31 days. The default is 1 day.</p>`; formHtml += `<input type="text" id="node-input-getDeviceClients_timespan" placeholder="msg.timespan" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceClients_timespanType" value="number" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "timespan" }) methodGroups.push({methodGroup:"Clients", methodName:"getDeviceClients", parameters: parameters, formHtml: formHtml, example: example, summary: `List the clients of a device up to a maximum of a month ago. The usage of each client is returned in kilobytes. If the device is a switch the switchport is returned; otherwise the switchport field is null.`}); var example = `[ { "ports": [ "1", "2-5", "1_MA-MOD-8X10G_1", "1_MA-MOD-8X10G_2-1_MA-MOD-8X10G_8" ] } ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="cycleDeviceSwitchPorts_serial">`; formHtml += `<label for="node-input-cycleDeviceSwitchPorts_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-cycleDeviceSwitchPorts_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-cycleDeviceSwitchPorts_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="cycleDeviceSwitchPorts_cycleDeviceSwitchPorts">`; formHtml += `<label for="node-input-cycleDeviceSwitchPorts_cycleDeviceSwitchPorts" style="width:70%"><i class="fa fa-list"></i> <span><b>cycleDeviceSwitchPorts<span style="color:red;"> *</span></b> <i>&nbsp</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-cycleDeviceSwitchPorts_cycleDeviceSwitchPorts" placeholder="msg.cycleDeviceSwitchPorts" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-cycleDeviceSwitchPorts_cycleDeviceSwitchPortsType" value="" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "cycleDeviceSwitchPorts" }) methodGroups.push({methodGroup:"Devices", methodName:"cycleDeviceSwitchPorts", parameters: parameters, formHtml: formHtml, example: example, summary: `Cycle a set of switch ports`}); var example = `[ [ { "portId": "1", "enabled": true, "status": "Connected", "errors": [ "PoE overload", "Very high proportion of CRC errors" ], "warnings": [ "PoE port was denied power", "High proportion of CRC errors" ], "speed": "10 Gbps", "duplex": "full", "usageInKb": { "total": 40867, "sent": 23008, "recv": 17859 }, "cdp": { "systemName": "", "platform": "MS350-24X", "deviceId": "0c8ddbddee:ff", "portId": "Port 20", "nativeVlan": 1, "address": "10.0,0.1", "managementAddress": "10.0.0.100", "version": "1", "vtpManagementDomain": "", "capabilities": "Switch" }, "lldp": { "systemName": "MS350-24X - Test", "systemDescription": "MS350-24X Cloud Managed PoE Switch", "portId": "20", "portDescription": "Port 20", "chassisId": "0c:8d:db:dd:ee:ff", "managementVlan": 1, "portVlan": 1, "managementAddress": "10.0.0.100", "systemCapabilities": "switch" }, "clientCount": 10, "powerUsageInWh": 55.9 } ] ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceSwitchPortStatuses_serial">`; formHtml += `<label for="node-input-getDeviceSwitchPortStatuses_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceSwitchPortStatuses_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceSwitchPortStatuses_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="getDeviceSwitchPortStatuses_t0">`; formHtml += `<label for="node-input-getDeviceSwitchPortStatuses_t0" style="width:70%"><i class="fa fa-list"></i> <span><b>t0</b> <i>&nbspstring</i></span></label>`; formHtml += `<p>The beginning of the timespan for the data. The maximum lookback period is 31 days from today.</p>`; formHtml += `<input type="text" id="node-input-getDeviceSwitchPortStatuses_t0" placeholder="msg.t0" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceSwitchPortStatuses_t0Type" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "t0" }) formHtml += `<div class="form-row" id="getDeviceSwitchPortStatuses_timespan">`; formHtml += `<label for="node-input-getDeviceSwitchPortStatuses_timespan" style="width:70%"><i class="fa fa-list"></i> <span><b>timespan</b> <i>&nbspnumber</i></span></label>`; formHtml += `<p>The timespan for which the information will be fetched. If specifying timespan, do not specify parameter t0. The value must be in seconds and be less than or equal to 31 days. The default is 1 day.</p>`; formHtml += `<input type="text" id="node-input-getDeviceSwitchPortStatuses_timespan" placeholder="msg.timespan" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceSwitchPortStatuses_timespanType" value="number" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "timespan" }) methodGroups.push({methodGroup:"Switch ports", methodName:"getDeviceSwitchPortStatuses", parameters: parameters, formHtml: formHtml, example: example, summary: `Return the status for all the ports of a switch`}); var example = `[ [ { "portId": "1", "packets": [ { "desc": "Total", "total": 112081, "sent": 104135, "recv": 7946, "ratePerSec": { "total": 1, "sent": 1, "recv": 0 } }, { "desc": "Broadcast", "total": 30884, "sent": 30370, "recv": 514, "ratePerSec": { "total": 0, "sent": 0, "recv": 0 } }, { "desc": "Multicast", "total": 67620, "sent": 66849, "recv": 771, "ratePerSec": { "total": 0, "sent": 0, "recv": 0 } }, { "desc": "CRC align errors", "total": 0, "sent": 0, "recv": 0, "ratePerSec": { "total": 0, "sent": 0, "recv": 0 } } ] } ] ]`; var parameters = [] var formHtml = ``; formHtml += `<h4>Parameters</h4>`; formHtml += `<div class="form-row" id="getDeviceSwitchPortStatusesPackets_serial">`; formHtml += `<label for="node-input-getDeviceSwitchPortStatusesPackets_serial" style="width:70%"><i class="fa fa-list"></i> <span><b>serial<span style="color:red;"> *</span></b> <i>&nbspstring</i></span></label>`; formHtml += `<p></p>`; formHtml += `<input type="text" id="node-input-getDeviceSwitchPortStatusesPackets_serial" placeholder="msg.serial" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceSwitchPortStatusesPackets_serialType" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "serial" }) formHtml += `<div class="form-row" id="getDeviceSwitchPortStatusesPackets_t0">`; formHtml += `<label for="node-input-getDeviceSwitchPortStatusesPackets_t0" style="width:70%"><i class="fa fa-list"></i> <span><b>t0</b> <i>&nbspstring</i></span></label>`; formHtml += `<p>The beginning of the timespan for the data. The maximum lookback period is 1 day from today.</p>`; formHtml += `<input type="text" id="node-input-getDeviceSwitchPortStatusesPackets_t0" placeholder="msg.t0" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceSwitchPortStatusesPackets_t0Type" value="string" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "t0" }) formHtml += `<div class="form-row" id="getDeviceSwitchPortStatusesPackets_timespan">`; formHtml += `<label for="node-input-getDeviceSwitchPortStatusesPackets_timespan" style="width:70%"><i class="fa fa-list"></i> <span><b>timespan</b> <i>&nbspnumber</i></span></label>`; formHtml += `<p>The timespan for which the information will be fetched. If specifying timespan, do not specify parameter t0. The value must be in seconds and be less than or equal to 1 day. The default is 1 day.</p>`; formHtml += `<input type="text" id="node-input-getDeviceSwitchPortStatusesPackets_timespan" placeholder="msg.timespan" style="width:70%">`; formHtml += `<input type="hidden" id="node-input-getDeviceSwitchPortStatusesPackets_timespanType" value="number" >`; formHtml += `</div>`; parameters.push({ camelCaseName: "timespan" }) methodGroups.push({methodGroup:"Switch ports", methodName:"getDeviceSwitchPortStatusesPackets", parameters: parameters, formHtml: formHtml, example: example, summary: `Return the packet counters for all the ports of a switch`}); var example = `[ [ { "number": 1, "name": "My switch port", "tags": "tag1 tag2", "enabled": true, "poeEnabled": true, "type": "access", "vlan": 10, "voiceVlan": 20, "isolationEnabled": false, "rstpEnabled": true,