03-07-2014 02:05 PM - edited 07-05-2021 12:22 AM
Hi -
We pull our wifi association data out via api with the following URL:
https://prime/webacs/api/v1/data/Clients.json?.maxResults=1000&.full=true&status=ASSOCIATED
Works great, except that we have more than 1000 associations at peak.
https://prime/webacs/api/v1/data/Clients.json?.maxResults=1001&.full=true&status=ASSOCIATED
Returns an apache tomcat error:
type Status report
message Requested maxResults: 1001 is greater than allowed maximum: 1000
description The requested service is not currently available.
What gives? How can we adjust maxResults for our Cisco Prime Infrasture api?
Thanks for any ideas -
Solved! Go to Solution.
03-11-2014 04:56 PM
Greetings.
Solved my own problem by using the paging feature on the api: https://prime/webacs/api/v1/?id=paging-doc
Instead of trying to get all your records in one api call, just get them 500 at a time:
Loop through your results by pages until your call returns 0:
.
.
.
I hope this helps someone else some day.
03-11-2014 04:56 PM
Greetings.
Solved my own problem by using the paging feature on the api: https://prime/webacs/api/v1/?id=paging-doc
Instead of trying to get all your records in one api call, just get them 500 at a time:
Loop through your results by pages until your call returns 0:
.
.
.
I hope this helps someone else some day.
09-12-2018 06:11 AM
That's just come in handy - thanks!
01-16-2021 10:45 AM
I know this is an old post which was resolved, but in order to help someone which wants to make an automatic query (by using python), I am sharing this.
It returns a list with all the results in blocks (with 1000 devices)
def get_inventory(): resultados = [] print("Lanzando consulta de inventario de switches...") args = { "productFamily": '"Switches and Hubs"', #Al pedir un tipo concreto debe ir con dobles comillas en la petición ".full": "true", ".maxResults": 1000 } r = session.get(url + "data/Devices.json", params=args) r_json = r.json() resultados.append(r_json['queryResponse']['entity']) equipos = r.json()['queryResponse']['@count'] last = r.json()['queryResponse']['@last'] contador = 2 while equipos > last+1: print(f"Obteniendo página {contador}") args[".firstResult"] = last+1 r = session.get(url + "data/Devices.json", params=args) r_json = r.json() resultados.append(r_json['queryResponse']['entity']) last = r.json()['queryResponse']['@last'] contador += 1 time.sleep(1) return resultados
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide