<?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: Adding Switch Information to API Call in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/adding-switch-information-to-api-call/m-p/5403014#M856</link>
    <description>&lt;P&gt;The recent device mac field in that call you are using would get you what you need to then use this call: &lt;A href="https://developer.cisco.com/meraki/api-v1/get-organization-inventory-devices/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developer.cisco.com/meraki/api-v1/get-organization-inventory-devices/&lt;/A&gt; to get the device names for each device and then you can tie them together in your code.&lt;BR /&gt;&lt;BR /&gt;I don't do much in python so I can't help with the code you'd need to add but hopefully the above will steer you.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Mar 2025 16:51:12 GMT</pubDate>
    <dc:creator>mloraditch</dc:creator>
    <dc:date>2025-03-25T16:51:12Z</dc:date>
    <item>
      <title>Adding Switch Information to API Call</title>
      <link>https://community.cisco.com/t5/network-platform-api/adding-switch-information-to-api-call/m-p/5403012#M854</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;I have a need to add what switch an endpoint o physically connected to. Currently, I am have the port information but since we have 8 switch stacks there is a need to which switch as well. I am currently using getOrganizationClientsSearch and this everything except the switch name. Is there an option to get the switch name based on the client connection? If so, whats the best way to add that in to my current code? Thanks in advance!&lt;/P&gt;&lt;P&gt;Below is my code snippet:&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;def find_device():

    clearconsole()
    
    API_KEY = get_meraki_api_key()
    dashboard = meraki.DashboardAPI(API_KEY, suppress_logging=True)

    organization_id = '412637'
    mac = input (Fore.WHITE + Style.BRIGHT + '\nWhich device are you trying to find (xx:xx:xx:xx:xx:xx): ')


    response = dashboard.organizations.getOrganizationClientsSearch(
        organization_id, mac, total_pages='all'
    )
    
    mac = response['mac']
    record = response['records']

    #print (response)
    print (Fore.GREEN,Style.BRIGHT + '\n' + 'Here is what I found: ' + '\n')
    print (Fore.WHITE,Style.BRIGHT + 'MAC Address: ' + Fore.YELLOW,Style.BRIGHT,response['mac'])
    print (Fore.WHITE,Style.BRIGHT + 'IP Address: ' + Fore.YELLOW,Style.BRIGHT,record[0]['ip'])
    if record[0]['description'] is not None:
        print (Fore.WHITE,Style.BRIGHT + 'Description: ' + Fore.YELLOW,Style.BRIGHT,record[0]['description'])
    if response['manufacturer'] is not None:
        print (Fore.WHITE,Style.BRIGHT + 'Manufacture: ' + Fore.YELLOW,Style.BRIGHT,response['manufacturer'])
    if record[0]['os'] is not None:
        print (Fore.WHITE,Style.BRIGHT + 'OS: ' + Fore.YELLOW,Style.BRIGHT,record[0]['os'])
    if record[0]['vlan'] &amp;gt; "0":
        print (Fore.WHITE,Style.BRIGHT + "VLAN: " + Fore.YELLOW,Style.BRIGHT,record[0]['vlan'])
    print (Fore.WHITE,Style.BRIGHT +"Network: "+ Fore.YELLOW,Style.BRIGHT,record[0]['network']['name'])
    print (Fore.WHITE,Style.BRIGHT +"Device Type: "+ Fore.YELLOW + Style.BRIGHT,record[0]['network']['productTypes'])
    if "wireless" in record[0]['network']['productTypes']:
        print (Fore.WHITE,Style.BRIGHT +"SSID: "+ Fore.YELLOW + Style.BRIGHT,record[0]['ssid'])
    if (("switch" in record[0]['network']['productTypes']) and (record[0]['switchport'] is not None)):
        #if record[0]['network']['productType'] is not None:
        print (Fore.WHITE,Style.BRIGHT +"Switchport: "+ Fore.YELLOW + Style.BRIGHT,record[0]['switchport'])
    if "None" == record[0]['user']:
        print (Fore.WHITE,Style.BRIGHT +"User: "+ Fore.YELLOW + Style.BRIGHT,record[0]['user'])
    print (Fore.WHITE,Style.BRIGHT +"Current Status: "+ Fore.YELLOW + Style.BRIGHT,record[0]['status'] + Style.RESET_ALL)
    print ("\n")
    
    whats_next = input ("\nWhat's Next: (M)ain Menu, (S)earch for another, or (Q)uit? ")
    if whats_next == "M" or "m":
        clearconsole()
        main_menu()
    if whats_next == "S" or "s":
        clearconsole()
        find_device()
    if whats_next == "Q" or "q":
        clearconsole()
        exit()&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Mar 2025 16:42:31 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adding-switch-information-to-api-call/m-p/5403012#M854</guid>
      <dc:creator>Ed Roche</dc:creator>
      <dc:date>2025-03-25T16:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Switch Information to API Call</title>
      <link>https://community.cisco.com/t5/network-platform-api/adding-switch-information-to-api-call/m-p/5403013#M855</link>
      <description>&lt;P&gt;You need to use the getDeviceLldpCdp Endpoint to get LLDP/CDP information, including the switch name and port details and modify your code adding a function to retrieve LLDP/CDP.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.cisco.com/meraki/api-v1/get-device-lldp-cdp/" target="_blank" rel="nofollow noopener noreferrer"&gt;Get Device Lldp Cdp - Meraki Dashboard API v1 - Cisco Meraki Developer Hub&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 16:47:33 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adding-switch-information-to-api-call/m-p/5403013#M855</guid>
      <dc:creator>aleabrahao</dc:creator>
      <dc:date>2025-03-25T16:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Switch Information to API Call</title>
      <link>https://community.cisco.com/t5/network-platform-api/adding-switch-information-to-api-call/m-p/5403014#M856</link>
      <description>&lt;P&gt;The recent device mac field in that call you are using would get you what you need to then use this call: &lt;A href="https://developer.cisco.com/meraki/api-v1/get-organization-inventory-devices/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developer.cisco.com/meraki/api-v1/get-organization-inventory-devices/&lt;/A&gt; to get the device names for each device and then you can tie them together in your code.&lt;BR /&gt;&lt;BR /&gt;I don't do much in python so I can't help with the code you'd need to add but hopefully the above will steer you.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 16:51:12 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/adding-switch-information-to-api-call/m-p/5403014#M856</guid>
      <dc:creator>mloraditch</dc:creator>
      <dc:date>2025-03-25T16:51:12Z</dc:date>
    </item>
  </channel>
</rss>

