{"type":"api","title":"Get Device Switch Ports Statuses","meta":{"id":"/apps/pubhub/media/Meraki-Dashboard-API-v1-Documentation/4723762d29b3380de018ae8c0d8a59499a6523e0/5c63a5d4-9452-397a-85eb-8b6fec45147e","info":{"title":"Meraki Dashboard API","description":"A RESTful API to programmatically manage and monitor Cisco Meraki networks at scale.\n\n> Date: 03 July, 2024\n>\n> [Recent Updates](https://meraki.io/whats-new/)\n\n---\n\n[API Documentation](https://meraki.io/api)\n\n[Community Support](https://meraki.io/community)\n\n[Meraki Homepage](https://www.meraki.com)\n","contact":{"name":"Meraki Developer Community","url":"https://meraki.io/community"},"version":"1.48.0"},"security":[{"meraki_api_key":[]},{"bearerAuth":[]}],"tags":[{"name":"organizations"},{"name":"networks"},{"name":"devices"},{"name":"insight"},{"name":"wireless"},{"name":"camera"},{"name":"appliance"},{"name":"switch"},{"name":"cellularGateway"},{"name":"sm"},{"name":"sensor"},{"name":"administered"},{"name":"accessControlLists"},{"name":"accessPolicies"},{"name":"acls"},{"name":"actionBatches"},{"name":"adaptivePolicy"},{"name":"addresses"},{"name":"admins"},{"name":"airMarshal"},{"name":"alertTypes"},{"name":"alerts"},{"name":"alternateManagementInterface"},{"name":"analytics"},{"name":"apiRequests"},{"name":"apnsCert"},{"name":"appliances"},{"name":"applicationCategories"},{"name":"applicationUsage"},{"name":"applications"},{"name":"areas"},{"name":"arpInspection"},{"name":"arpTable"},{"name":"artifacts"},{"name":"assets"},{"name":"assignments"},{"name":"authenticationToken"},{"name":"availabilities"},{"name":"bandwidthUsageHistory"},{"name":"bgp"},{"name":"billing"},{"name":"bluetooth"},{"name":"bluetoothClients"},{"name":"bonjourForwarding"},{"name":"boundaries"},{"name":"brandingPolicies"},{"name":"bulk"},{"name":"bulkUpdate"},{"name":"byBoundary"},{"name":"byClient"},{"name":"byDevice"},{"name":"byEnergyUsage"},{"name":"byInterval"},{"name":"byMetric"},{"name":"byModel"},{"name":"byNetwork"},{"name":"byStatus"},{"name":"bySwitch"},{"name":"byType"},{"name":"byUsage"},{"name":"byUtilization"},{"name":"bypassActivationLockAttempts"},{"name":"cableTest"},{"name":"callbacks"},{"name":"categories"},{"name":"cellular"},{"name":"cellularFirewallRules"},{"name":"cellularUsageHistory"},{"name":"certs"},{"name":"changeHistory"},{"name":"channelUtilization"},{"name":"channelUtilizationHistory"},{"name":"claim"},{"name":"claimKey"},{"name":"clientCountHistory"},{"name":"clients"},{"name":"cloudMonitoring"},{"name":"commands"},{"name":"compliance"},{"name":"configTemplates"},{"name":"configurationChanges"},{"name":"configure"},{"name":"configuredDevices"},{"name":"connectionStats"},{"name":"connectivity"},{"name":"connectivityEvents"},{"name":"connectivityMonitoringDestinations"},{"name":"contentFiltering"},{"name":"coterm"},{"name":"current"},{"name":"customAnalytics"},{"name":"customPerformanceClasses"},{"name":"dataRateHistory"},{"name":"delegated"},{"name":"desktopLogs"},{"name":"details"},{"name":"detections"},{"name":"deviceCommandLogs"},{"name":"deviceProfiles"},{"name":"deviceTypeGroupPolicies"},{"name":"dhcp"},{"name":"dhcpServerPolicy"},{"name":"dscpTaggingOptions"},{"name":"dscpToCosMappings"},{"name":"eapOverride"},{"name":"earlyAccess"},{"name":"electronicShelfLabel"},{"name":"entitlements"},{"name":"ethernet"},{"name":"eventTypes"},{"name":"events"},{"name":"exportEvents"},{"name":"failedConnections"},{"name":"features"},{"name":"fields"},{"name":"firewall"},{"name":"firewalledServices"},{"name":"firmware"},{"name":"firmwareUpgrades"},{"name":"floorPlans"},{"name":"groupPolicies"},{"name":"groups"},{"name":"health"},{"name":"healthByTime"},{"name":"historical"},{"name":"history"},{"name":"hotspot20"},{"name":"httpServers"},{"name":"identities"},{"name":"identityPsks"},{"name":"idps"},{"name":"imports"},{"name":"inboundCellularFirewallRules"},{"name":"inboundFirewallRules"},{"name":"interfaces"},{"name":"internetPolicies"},{"name":"intrusion"},{"name":"inventory"},{"name":"ipv6"},{"name":"l3FirewallRules"},{"name":"l7FirewallRules"},{"name":"lan"},{"name":"latencyHistory"},{"name":"latencyStats"},{"name":"latest"},{"name":"licenses"},{"name":"licensing"},{"name":"lines"},{"name":"linkAggregations"},{"name":"linkLayer"},{"name":"live"},{"name":"liveTools"},{"name":"lldpCdp"},{"name":"loginSecurity"},{"name":"logs"},{"name":"lossAndLatencyHistory"},{"name":"malware"},{"name":"managementInterface"},{"name":"manufacturers"},{"name":"me"},{"name":"merakiAuthUsers"},{"name":"meshStatuses"},{"name":"models"},{"name":"monitor"},{"name":"monitoredMediaServers"},{"name":"mqttBrokers"},{"name":"mtu"},{"name":"multicast"},{"name":"netflow"},{"name":"networkAdapters"},{"name":"networkHealth"},{"name":"objectDetectionModels"},{"name":"onboarding"},{"name":"oneToManyNatRules"},{"name":"oneToOneNatRules"},{"name":"openapiSpec"},{"name":"optIns"},{"name":"order"},{"name":"ospf"},{"name":"overview"},{"name":"packetLoss"},{"name":"packets"},{"name":"payloadTemplates"},{"name":"performance"},{"name":"performanceHistory"},{"name":"permissions"},{"name":"pii"},{"name":"piiKeys"},{"name":"ping"},{"name":"pingDevice"},{"name":"policies"},{"name":"policy"},{"name":"policyObjects"},{"name":"portForwardingRules"},{"name":"portSchedules"},{"name":"ports"},{"name":"power"},{"name":"powerModules"},{"name":"prefixes"},{"name":"prepare"},{"name":"priorities"},{"name":"profiles"},{"name":"provisioning"},{"name":"qosRules"},{"name":"qualityAndRetention"},{"name":"qualityRetentionProfiles"},{"name":"radio"},{"name":"readings"},{"name":"recent"},{"name":"relationships"},{"name":"rendezvousPoints"},{"name":"requests"},{"name":"responseCodes"},{"name":"restrictions"},{"name":"rfProfiles"},{"name":"roles"},{"name":"rollbacks"},{"name":"routing"},{"name":"rules"},{"name":"saml"},{"name":"samlRoles"},{"name":"schedules"},{"name":"sdwan"},{"name":"search"},{"name":"security"},{"name":"securityCenters"},{"name":"seen"},{"name":"sense"},{"name":"sentry"},{"name":"servers"},{"name":"settings"},{"name":"signalQualityHistory"},{"name":"sims"},{"name":"singleLan"},{"name":"siteToSiteVpn"},{"name":"smDevicesForKey"},{"name":"smOwnersForKey"},{"name":"snmp"},{"name":"softwares"},{"name":"splash"},{"name":"splashAuthorizationStatus"},{"name":"splashLoginAttempts"},{"name":"ssids"},{"name":"stacks"},{"name":"staged"},{"name":"stages"},{"name":"staticRoutes"},{"name":"statics"},{"name":"stats"},{"name":"status"},{"name":"statuses"},{"name":"stormControl"},{"name":"stp"},{"name":"subnetPool"},{"name":"subnets"},{"name":"subscription"},{"name":"subscriptions"},{"name":"summary"},{"name":"swaps"},{"name":"switches"},{"name":"syslogServers"},{"name":"targetGroups"},{"name":"themes"},{"name":"thirdPartyVPNPeers"},{"name":"throughputTest"},{"name":"top"},{"name":"topology"},{"name":"traffic"},{"name":"trafficAnalysis"},{"name":"trafficHistory"},{"name":"trafficShaping"},{"name":"trustedAccessConfigs"},{"name":"trustedServers"},{"name":"upgrades"},{"name":"uplink"},{"name":"uplinkBandwidth"},{"name":"uplinkSelection"},{"name":"uplinks"},{"name":"uplinksLossAndLatency"},{"name":"usage"},{"name":"usageHistories"},{"name":"usageHistory"},{"name":"userAccessDevices"},{"name":"users"},{"name":"v4"},{"name":"video"},{"name":"videoLink"},{"name":"vlanAssignments"},{"name":"vlanProfiles"},{"name":"vlans"},{"name":"vmx"},{"name":"vpn"},{"name":"vpnExclusions"},{"name":"vpnFirewallRules"},{"name":"vppAccounts"},{"name":"wakeOnLan"},{"name":"warmSpare"},{"name":"warnings"},{"name":"webhookTests"},{"name":"webhooks"},{"name":"wirelessProfiles"},{"name":"wlanLists"},{"name":"zones"}],"x-parser-conf":{"overview":{"markdownPath":"docs/overview.md"},"theme":"meraki","serverConfig":true,"meta":{"useProxy":true},"httpBearer":{"bearerToken":"75dd5334bef4d2bc96f26138c163c0a3fa0b5ca6"},"labelConfig":{"endpoint":{"field":"operationId","format":"startCase"}},"groupBy":{"$remoteModule":"config/group_platform.js"},"sortBy":{"$remoteModule":"config/sort_by.js"},"exampleAsDefault":true,"expand":3,"sampleCode":{"python":{"folder":"meraki/sdk/python","name":"Meraki Python Library","highlight":"python"}},"variables":{"organizationId":"1215707","networkId":"N_784752235069315754","serial":"QBSB-VQ3J-XZ54"}},"openapi":"3.0.1","servers":[{"url":"https://api.meraki.com/{basePath}","variables":{"basePath":{"default":"api/v1"}}}],"securitySchemes":{"meraki_api_key":{"type":"apiKey","name":"X-Cisco-Meraki-API-Key","in":"header"},"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}}},"spec":{"description":"Return the status for all the ports of a switch","operationId":"getDeviceSwitchPortsStatuses","parameters":[{"name":"serial","in":"path","description":"Serial","schema":{"type":"string"},"required":true},{"name":"t0","in":"query","description":"The beginning of the timespan for the data. The maximum lookback period is 31 days from today.","schema":{"type":"string"}},{"name":"timespan","in":"query","description":"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.","schema":{"type":"number","format":"float","maximum":2678400}}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"portId":{"type":"string","description":"The string identifier of this port on the switch. This is commonly just the port number but may contain additional identifying information such as the slot and module-type if the port is located on a port module."},"enabled":{"type":"boolean","description":"Whether the port is configured to be enabled."},"status":{"type":"string","enum":["Connected","Disabled","Disconnected"],"description":"The current connection status of the port."},"spanningTree":{"type":"object","properties":{"statuses":{"type":"array","items":{"type":"string"},"description":"The current Spanning Tree Protocol statuses of the port."}},"description":"The Spanning Tree Protocol (STP) information of the connected device."},"isUplink":{"type":"boolean","description":"Whether the port is the switch's uplink."},"errors":{"type":"array","items":{"type":"string"},"description":"All errors present on the port."},"warnings":{"type":"array","items":{"type":"string"},"description":"All warnings present on the port."},"speed":{"type":"string","enum":["","1 Gbps","10 Gbps","10 Mbps","100 Gbps","100 Mbps","2.5 Gbps","20 Gbps","40 Gbps","5 Gbps"],"description":"The current data transfer rate which the port is operating at."},"duplex":{"type":"string","enum":["","full","half"],"description":"The current duplex of a connected port."},"usageInKb":{"type":"object","properties":{"total":{"type":"integer","description":"The total amount of data sent and received (in kilobytes)."},"sent":{"type":"integer","description":"The amount of data sent (in kilobytes)."},"recv":{"type":"integer","description":"The amount of data received (in kilobytes)."}},"description":"A breakdown of how many kilobytes have passed through this port during the timespan."},"cdp":{"type":"object","properties":{"systemName":{"type":"string","description":"The system name."},"platform":{"type":"string","description":"Identifies the hardware platform of the device."},"deviceId":{"type":"string","description":"Identifies the device name."},"portId":{"type":"string","description":"Identifies the port from which the CDP packet was sent."},"nativeVlan":{"type":"integer","description":"Indicates, per interface, the assumed VLAN for untagged packets on the interface."},"address":{"type":"string","description":"Contains network addresses of both receiving and sending devices."},"managementAddress":{"type":"string","description":"The device's management IP."},"version":{"type":"string","description":"Contains the device software release information."},"vtpManagementDomain":{"type":"string","description":"Advertises the configured VLAN Trunking Protocl (VTP)-management-domain name of the system."},"capabilities":{"type":"string","description":"Identifies the device type, which indicates the functional capabilities of the device."}},"description":"The Cisco Discovery Protocol (CDP) information of the connected device."},"lldp":{"type":"object","properties":{"systemName":{"type":"string","description":"The device's system name."},"systemDescription":{"type":"string","description":"The device's system description."},"chassisId":{"type":"string","description":"The device's chassis ID."},"portId":{"type":"string","description":"Identifies the port from which the LLDP packet was sent"},"managementVlan":{"type":"integer","description":"The device's management VLAN."},"portVlan":{"type":"integer","description":"The port's VLAN."},"managementAddress":{"type":"string","description":"The device's management IP."},"portDescription":{"type":"string","description":"Description of the port from which the LLDP packet was sent."},"systemCapabilities":{"type":"string","description":"Identifies the device type, which indicates the functional capabilities of the device."}},"description":"The Link Layer Discovery Protocol (LLDP) information of the connected device."},"clientCount":{"type":"integer","description":"The number of clients connected through this port."},"powerUsageInWh":{"type":"number","format":"float","description":"How much power (in watt-hours) has been delivered by this port during the timespan."},"trafficInKbps":{"type":"object","properties":{"total":{"type":"number","format":"float","description":"The average speed of the data sent and received (in kilobits-per-second)."},"sent":{"type":"number","format":"float","description":"The average speed of the data sent (in kilobits-per-second)."},"recv":{"type":"number","format":"float","description":"The average speed of the data received (in kilobits-per-second)."}},"description":"A breakdown of the average speed of data that has passed through this port during the timespan."},"securePort":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether Secure Port is turned on for this port."},"active":{"type":"boolean","description":"Whether Secure Port is currently active for this port."},"authenticationStatus":{"type":"string","enum":["Authentication failure","Authentication in progress","Authentication successful","Authentication timed out","Disabled","Enabled"],"description":"The current Secure Port status."},"configOverrides":{"type":"object","properties":{"type":{"type":"string","enum":["access","stack","trunk"],"description":"The type of the ('trunk', 'access' or 'stack')."},"vlan":{"type":"integer","description":"The VLAN of the . For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports."},"voiceVlan":{"type":"integer","description":"The voice VLAN of the . Only applicable to access ports."},"allowedVlans":{"type":"string","description":"The VLANs allowed on the . Only applicable to trunk ports."}},"description":"The configuration overrides applied to this port when Secure Port is active."}},"description":"The Secure Port status of the port."},"poe":{"type":"object","properties":{"isAllocated":{"type":"boolean","description":"Whether the port is drawing power"}},"description":"PoE status of the port."}}}},"example":[{"portId":"1","enabled":true,"status":"Connected","spanningTree":{"statuses":["Learning"]},"isUplink":false,"errors":["PoE overload","Very high proportion of CRC errors"],"warnings":["SecurePort authentication in progress","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","chassisId":"0c:8d:db:dd:ee:ff","portId":"20","managementVlan":1,"portVlan":1,"managementAddress":"10.0.0.100","portDescription":"Port 20","systemCapabilities":"switch"},"clientCount":10,"powerUsageInWh":55.9,"trafficInKbps":{"total":2.2,"sent":1.2,"recv":1},"securePort":{"enabled":true,"active":true,"authenticationStatus":"Authentication in progress","configOverrides":{"type":"trunk","vlan":12,"voiceVlan":34,"allowedVlans":"all"}},"poe":{"isAllocated":false}}]}}}},"summary":"Return the status for all the ports of a switch","tags":["switch","monitor","ports","statuses"],"__originalOperationId":"getDeviceSwitchPortsStatuses","security":[{"meraki_api_key":[]},{"bearerAuth":[]}],"method":"get","path":"/devices/{serial}/switch/ports/statuses","sampleCode":{"Meraki Python Library":{"code":"import meraki\n\n# Defining your API key as a variable in source code is discouraged.\n# This API key is for a read-only docs-specific environment.\n# In your own code, use an environment variable as shown under the Usage section\n# @ https://github.com/meraki/dashboard-api-python/\n\nAPI_KEY = '75dd5334bef4d2bc96f26138c163c0a3fa0b5ca6'\n\ndashboard = meraki.DashboardAPI(API_KEY)\n\nserial = 'Q2QN-9J8L-SLPD'\n\nresponse = dashboard.switch.getDeviceSwitchPortsStatuses(\n serial\n)\n\nprint(response)","highlight":"python"}}}}