cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3064
Views
1
Helpful
4
Replies

Prime Infrastructure v2.2 REST API ClientSessions

praveen.batchu1
Level 1
Level 1

Hi, Using Prime Infrastructure v2.2 REST API ClientSessions, working on pulling all the data. When I run the below query in Postman I see 890K records but, I get only 1000 records. How to retreive all the records and also, Is there a date parameter to use with this?

/webacs/api/v1/data/ClientSessions.json?.full=true&.maxResults=1000&.firstResult=0

Thanks & Regards

1 Accepted Solution

Accepted Solutions

Spencer Zier
Cisco Employee
Cisco Employee

1000 records is the maximum page size.  You can get all of the client sessions by paging through the results; to do this, increment .firstResult by the value of .maxResults.  So in your case, with .maxResults=1000, start .firstResult at 0, then 1000, 2000, 3000, etc.

You can also combine this with filtering.  Since a client session that's finished is unlikely to be updated, finished sessions that you've already captured don't need to be fetched again.  So you could filter with sessionStartTime to look for sessions that have started since the last time you polled for sessions, and/or filter with sessionEndTime to look for sessions that have ended since the last time you polled for sessions.

View solution in original post

4 Replies 4

Spencer Zier
Cisco Employee
Cisco Employee

1000 records is the maximum page size.  You can get all of the client sessions by paging through the results; to do this, increment .firstResult by the value of .maxResults.  So in your case, with .maxResults=1000, start .firstResult at 0, then 1000, 2000, 3000, etc.

You can also combine this with filtering.  Since a client session that's finished is unlikely to be updated, finished sessions that you've already captured don't need to be fetched again.  So you could filter with sessionStartTime to look for sessions that have started since the last time you polled for sessions, and/or filter with sessionEndTime to look for sessions that have ended since the last time you polled for sessions.

Thanks very much Spencer. The sessionStartTime  is UNIX date format, So it should be filtered using the same format right?

It's pretty close to Unix format; whereas Unix format is seconds since 00:00:00 Jan 1, 1970 UTC-0, our representation is in milliseconds.  So if you are using a standard long to String converter, divide the value by 1000 before converting.

mltllt
Level 1
Level 1

After struggling to figure out how to actually use this API call effectively I discovered the trick. 

My instance of prime is returning 6,523,914 sessions. 

When I filter for the apMacAddress it takes about 15 seconds to return the first 100 records. 

That is way too long. 

But I only really care about the currently connected clients. 

So using sessionEndTime set to the end of 2099 and the apMacAddress I am able to return all connected clients in under 100ms. 

Even in the case of one of my heavily loaded AP's with 120ish clients the response is very fast. 

There is some delay in the reporting from the WLC to Prime, maybe like 10 minutes or so. 

Be sure to use the baseMacAddress and not the ethernetMacAddress for the filter. 

https://primeserver/webacs/api/v3/data/ClientSessions.json?.full=true&sessionEndTime=eq("4102444800000")&apMacAddress="99:99:99:99:99:99"

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: