We Have 2500+ networks - API call only sends back 1000 ? Yet its only 1 API call?

SOLVED
AidanVenn
Here to help

We Have 2500+ networks - API call only sends back 1000 ? Yet its only 1 API call?

Hi,

 

Simple script below.

 

I send a call I assume once. Therefore well within the limit? Yet only get the first 1000 networks yet we have 2500+.

 

Is this correct? Do I need to take a different approach?

 

Help appreciated.

 

thanks

 

Aidan

 

 

import requests
import json
import time
import datetime
# import system

 

now = datetime.datetime.now()

 

# Define variables
API_KEY = 'xxx'
MERAKI_URL = 'https://api.meraki.com/api/v1/'
ORG_KEY = 'xxx'
headers = {'X-Cisco-Meraki-API-Key': API_KEY}


def main(i=0):

 

# ************** GET the current list of networks

 

NETWORKS = '/organizations/' + ORG_KEY + '/networks'

NETWORK_list = requests.get(MERAKI_URL + NETWORKS, headers=headers)

print(NETWORK_list)

1 ACCEPTED SOLUTION
AutomationDude
Building a reputation

Hi Aidan,

 

Don't worry, this is normal expected behaviour from the API as there is a limit of 1000 for entries returned. This has been discussed a few times on the community before so here are some links for you to gain a better understanding and find a solution:

 

https://community.meraki.com/t5/Developers-APIs/Limited-search/m-p/102863

https://community.meraki.com/t5/Developers-APIs/How-can-I-specify-a-time-range-using-GET-networks-ne...

https://community.meraki.com/t5/Developers-APIs/Retrieving-more-than-2-pages-of-1000-clients-from-GE...

 

Essentially, you will need to make a 2nd and 3rd API call and define a new starting point in order to obtain all of the networks. Hope this helps!

 

View solution in original post

1 REPLY 1
AutomationDude
Building a reputation

Hi Aidan,

 

Don't worry, this is normal expected behaviour from the API as there is a limit of 1000 for entries returned. This has been discussed a few times on the community before so here are some links for you to gain a better understanding and find a solution:

 

https://community.meraki.com/t5/Developers-APIs/Limited-search/m-p/102863

https://community.meraki.com/t5/Developers-APIs/How-can-I-specify-a-time-range-using-GET-networks-ne...

https://community.meraki.com/t5/Developers-APIs/Retrieving-more-than-2-pages-of-1000-clients-from-GE...

 

Essentially, you will need to make a 2nd and 3rd API call and define a new starting point in order to obtain all of the networks. Hope this helps!

 

Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.