<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API not working all the sudden - cycle ports in specific vlan in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407981#M1543</link>
    <description>&lt;P&gt;Great to hear!&lt;/P&gt;&lt;P&gt;While you’re at it, you can consider using &lt;SPAN&gt;getOrganizationDevices specifying productTypes=“switch”, which will retrieve only switches (saving you to filter the results afterwards).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or, skip two steps by leveraging &lt;A href="https://developer.cisco.com/meraki/api-v1/get-organization-switch-ports-by-switch/" target="_blank" rel="noopener nofollow noreferrer"&gt;getOrganizationSwitchPortsBySwitch&lt;/A&gt; which will get you the port configurations of all switches in the organization.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In a small environment it won’t matter much, but in larger ones - it would be a ~80% API call reduction.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 May 2025 14:55:10 GMT</pubDate>
    <dc:creator>obrigg</dc:creator>
    <dc:date>2025-05-22T14:55:10Z</dc:date>
    <item>
      <title>API not working all the sudden - cycle ports in specific vlan</title>
      <link>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407977#M1539</link>
      <description>&lt;P&gt;I got the below working yesterday.  now today it just keeps cycling the same port over and over.&lt;/P&gt;&lt;P&gt;I was hoping someone could assist in where I made a mistake or help tweak this.&lt;/P&gt;&lt;P&gt;I am trying to cycle any port in a defined net id that is set to the target vlan.&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;import meraki

target_vlan = 5

# Create Meraki API Dashboard interface
dashboard = meraki.DashboardAPI(API_KEY, suppress_logging=True)

devices = dashboard.organizations.getOrganizationDevices(ORG_ID, total_pages='all', networkIds=[NET_ID])
for device in devices:
    if device['productType'] == 'switch':
        device_ports = dashboard.switch.getDeviceSwitchPorts(device['serial'])

# Filter ports by VLAN
ports_to_cycle = []
for port in device_ports:
    if port['vlan'] == target_vlan:
        ports_to_cycle.append(str(port['portId']))

    # Cycle the selected ports
    if ports_to_cycle:
        dashboard.switch.cycleDeviceSwitchPorts(device['serial'], ports_to_cycle)
        print(f"Successfully cycled ports {ports_to_cycle} on switch {device['name']} in VLAN {target_vlan}")
    else:
        print(f"No ports found in VLAN {target_vlan} on switch {device['name']}")&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 May 2025 16:09:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407977#M1539</guid>
      <dc:creator>What In the</dc:creator>
      <dc:date>2025-05-21T16:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: API not working all the sudden - cycle ports in specific vlan</title>
      <link>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407978#M1540</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You're calling cycleDeviceSwitchPorts() inside the loop that checks each port, which means it could be triggered multiple times unnecessarily, especially if multiple ports match the VLAN.&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 16:33:28 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407978#M1540</guid>
      <dc:creator>aleabrahao</dc:creator>
      <dc:date>2025-05-21T16:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: API not working all the sudden - cycle ports in specific vlan</title>
      <link>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407979#M1541</link>
      <description>&lt;P&gt;Could this be an indentation problem?&lt;BR /&gt;"ports_to_cycle" does not seem to be under the "for device in devices:" loop, which would mean only the last device/serial number would make it into "ports_to_cycle".&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 16:43:03 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407979#M1541</guid>
      <dc:creator>obrigg</dc:creator>
      <dc:date>2025-05-21T16:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: API not working all the sudden - cycle ports in specific vlan</title>
      <link>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407980#M1542</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;It was an indent issue.  Not sure how it changed.  I think PyCharm prompted me about format change  and I selected that.  &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 14:47:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407980#M1542</guid>
      <dc:creator>What In the</dc:creator>
      <dc:date>2025-05-22T14:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: API not working all the sudden - cycle ports in specific vlan</title>
      <link>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407981#M1543</link>
      <description>&lt;P&gt;Great to hear!&lt;/P&gt;&lt;P&gt;While you’re at it, you can consider using &lt;SPAN&gt;getOrganizationDevices specifying productTypes=“switch”, which will retrieve only switches (saving you to filter the results afterwards).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or, skip two steps by leveraging &lt;A href="https://developer.cisco.com/meraki/api-v1/get-organization-switch-ports-by-switch/" target="_blank" rel="noopener nofollow noreferrer"&gt;getOrganizationSwitchPortsBySwitch&lt;/A&gt; which will get you the port configurations of all switches in the organization.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In a small environment it won’t matter much, but in larger ones - it would be a ~80% API call reduction.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 14:55:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/api-not-working-all-the-sudden-cycle-ports-in-specific-vlan/m-p/5407981#M1543</guid>
      <dc:creator>obrigg</dc:creator>
      <dc:date>2025-05-22T14:55:10Z</dc:date>
    </item>
  </channel>
</rss>

