<?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: Meraki API - Get All Clients from All Networks in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/meraki-api-get-all-clients-from-all-networks/m-p/5407001#M1428</link>
    <description>&lt;P&gt;Changing from getClients to getNetworkClients worked!!!!!!!&lt;/P&gt;&lt;P&gt;network_id wouldn't apply here since I am wanting to return all Networks in my org. so I did have to change that argument to (&lt;/P&gt;&lt;P&gt;curr_net_id)&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jun 2022 21:06:11 GMT</pubDate>
    <dc:creator>alex.castillo</dc:creator>
    <dc:date>2022-06-08T21:06:11Z</dc:date>
    <item>
      <title>Meraki API - Get All Clients from All Networks</title>
      <link>https://community.cisco.com/t5/network-platform-api/meraki-api-get-all-clients-from-all-networks/m-p/5406999#M1426</link>
      <description>&lt;P&gt;Hello, I am attempting to get client info from all clients connected to all networks in my organization. I have been referencing this community forum post, but I am stuck about mid-way through. &lt;/P&gt;&lt;P&gt;Post in reference - &lt;A href="https://community.meraki.com/t5/Dashboard-Administration/Meraki-Dashboard-Reporting-How-can-I-get-a-csv-of-All-Clients-on/m-p/40051" target="_blank"&gt;https://community.meraki.com/t5/Dashboard-Administration/Meraki-Dashboard-Reporting-How-can-I-get-a-csv-of-All-Clients-on/m-p/40051&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have done quite a bit of editing due to the different versions of API &amp;amp; Meraki module. &lt;/P&gt;&lt;P&gt;See below for code example - &lt;/P&gt;&lt;P&gt;# Import "meraki" to allow Meraki function calls&lt;BR /&gt;import meraki&lt;/P&gt;&lt;P&gt;# Import "datetime" to get current date and time&lt;BR /&gt;import datetime&lt;/P&gt;&lt;P&gt;# ///////// Start Definition of Script Constants ////////////////&lt;BR /&gt;# api_key = Unique API key generated on a per Meraki User basis&lt;BR /&gt;# org_id = Unique organization ID of organization you want to query&lt;/P&gt;&lt;P&gt;api_key = 'XXXXXXXXXXXXXXXXXXXX'&lt;BR /&gt;org_id = 'XXXXXX'&lt;/P&gt;&lt;P&gt;dashboard = meraki.DashboardAPI(api_key)&lt;/P&gt;&lt;P&gt;# Get the current list of networks from your Organization&lt;BR /&gt;current_networks = dashboard.organizations.getOrganizationNetworks(org_id, total_pages='all')&lt;/P&gt;&lt;P&gt;# Establish when "now" is, used to create the file name for output&lt;BR /&gt;now = datetime.datetime.now()&lt;/P&gt;&lt;P&gt;# Create/Name the output file with year, month, day and hour minutes&lt;BR /&gt;filename = now.strftime("%Y-%m-%d %H.%M") + ".txt"&lt;/P&gt;&lt;P&gt;# Open the file for output&lt;BR /&gt;f = open(filename,"w+")&lt;/P&gt;&lt;P&gt;# "i" will be used to increment through each "network" in the Organization&lt;BR /&gt;i = 0&lt;/P&gt;&lt;P&gt;for i in range(len(current_networks)):&lt;/P&gt;&lt;P&gt;# Output to console the Name and ID of the current network&lt;BR /&gt;print(current_networks[i]['name'])&lt;BR /&gt;print(current_networks[i]['id'])&lt;/P&gt;&lt;P&gt;curr_net_id = current_networks[i]['id']&lt;BR /&gt;curr_net_devices = dashboard.networks.getNetworkDevices(curr_net_id)&lt;/P&gt;&lt;P&gt;# Write to the output file the 'name' of the network and add a comma&lt;BR /&gt;f.write(current_networks[i]['name'])&lt;BR /&gt;f.write(",")&lt;/P&gt;&lt;P&gt;# Checks for Meraki devices on this network, if there are no devices output to file "No Devices Present"&lt;BR /&gt;if len(curr_net_devices) == 0:&lt;BR /&gt;f.write("No devices Present")&lt;BR /&gt;f.write("\n")&lt;/P&gt;&lt;P&gt;# "j" will be used to increment through each "device" on this network&lt;BR /&gt;j = 0&lt;/P&gt;&lt;P&gt;for j in range(len(curr_net_devices)):&lt;BR /&gt;# Output to console the serial number of the device&lt;BR /&gt;print (curr_net_devices[j]['serial'])&lt;BR /&gt;curr_clients = dashboard.organizations.getclients(api_key,curr_net_devices[j]['serial'])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Checks for clients attached to this device, if no clients present output the name, model and serial of the&lt;BR /&gt;# device as well as the message "No Clients"&lt;BR /&gt;if len(curr_clients) == 0:&lt;BR /&gt;# Output to console "No Clients" message&lt;BR /&gt;print ("No clients")&lt;/P&gt;&lt;P&gt;# Output to file "name", "model", "serial" of the device as well as "No Clients" message&lt;BR /&gt;f.write(current_networks[i]['name'])&lt;BR /&gt;f.write(',')&lt;BR /&gt;f.write(curr_net_devices[j]['model'])&lt;BR /&gt;f.write(',')&lt;BR /&gt;f.write(curr_net_devices[j]['serial'])&lt;BR /&gt;f.write(",")&lt;BR /&gt;f.write("No Clients")&lt;BR /&gt;f.write("\n")&lt;/P&gt;&lt;P&gt;# "k" will be used to increment the number of clients on each device&lt;BR /&gt;k = 0&lt;/P&gt;&lt;P&gt;for k in range(len(curr_clients)):&lt;BR /&gt;# Output to console "description" and "mac" of the client&lt;BR /&gt;print (curr_clients[k]['description'],',',curr_clients[k]['mac'])&lt;/P&gt;&lt;P&gt;# Output to file "name", "model", "serial" of the device as well as the "description" and "mac"&lt;BR /&gt;# of the client&lt;BR /&gt;f.write(current_networks[i]['name'])&lt;BR /&gt;f.write(',')&lt;BR /&gt;f.write(curr_net_devices[j]['model'])&lt;BR /&gt;f.write(',')&lt;BR /&gt;f.write(str(curr_net_devices[j]['name']))&lt;BR /&gt;f.write(',')&lt;BR /&gt;f.write(curr_net_devices[j]['serial'])&lt;BR /&gt;f.write(',')&lt;BR /&gt;f.write(str(curr_clients[k]['description']))&lt;BR /&gt;f.write(',')&lt;BR /&gt;f.write(curr_clients[k]['mac'])&lt;BR /&gt;f.write("\n")&lt;/P&gt;&lt;P&gt;# Increment "k" to move onto next client on current device&lt;BR /&gt;k = k + 1&lt;/P&gt;&lt;P&gt;# Increment "j" to move onto next device on current Network&lt;BR /&gt;j = j + 1&lt;BR /&gt;# Increment "i" to move onto next network in Organization&lt;BR /&gt;i = i + 1&lt;/P&gt;&lt;P&gt;# Close the output file&lt;BR /&gt;f.close()&lt;/P&gt;&lt;P&gt;Error message - 'Organizations' object has no attribute 'getclients'&lt;/P&gt;&lt;P&gt;Line I see the error is -  'curr_clients = dashboard.organizations.getclients(api_key,curr_net_devices[j]['serial'])'&lt;/P&gt;&lt;P&gt;Does anyone know the correct syntax for a getclients pull in this scenario? &lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 16:46:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/meraki-api-get-all-clients-from-all-networks/m-p/5406999#M1426</guid>
      <dc:creator>alex.castillo</dc:creator>
      <dc:date>2022-06-08T16:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Meraki API - Get All Clients from All Networks</title>
      <link>https://community.cisco.com/t5/network-platform-api/meraki-api-get-all-clients-from-all-networks/m-p/5407000#M1427</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Please refer to the official API documentation : &lt;A href="https://developer.cisco.com/meraki/api-latest/#!get-network-clients" target="_blank" rel="noopener nofollow noreferrer"&gt;https://developer.cisco.com/meraki/api-latest/#!get-network-clients&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It should be something like : d&lt;SPAN&gt;ashboard&lt;/SPAN&gt;&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;STRONG&gt;networks&lt;/STRONG&gt;&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getNetworkClients&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN&gt; network_id&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;SPAN&gt; total_pages&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;'all'&lt;/SPAN&gt; &lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 17:31:20 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/meraki-api-get-all-clients-from-all-networks/m-p/5407000#M1427</guid>
      <dc:creator>Raphael_L</dc:creator>
      <dc:date>2022-06-08T17:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Meraki API - Get All Clients from All Networks</title>
      <link>https://community.cisco.com/t5/network-platform-api/meraki-api-get-all-clients-from-all-networks/m-p/5407001#M1428</link>
      <description>&lt;P&gt;Changing from getClients to getNetworkClients worked!!!!!!!&lt;/P&gt;&lt;P&gt;network_id wouldn't apply here since I am wanting to return all Networks in my org. so I did have to change that argument to (&lt;/P&gt;&lt;P&gt;curr_net_id)&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 21:06:11 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/meraki-api-get-all-clients-from-all-networks/m-p/5407001#M1428</guid>
      <dc:creator>alex.castillo</dc:creator>
      <dc:date>2022-06-08T21:06:11Z</dc:date>
    </item>
  </channel>
</rss>

