Community discussions

MikroTik App
 
electravis
Member Candidate
Member Candidate
Topic Author
Posts: 274
Joined: Tue Jan 26, 2010 12:06 am

Limit to API Call

Wed May 09, 2018 8:22 pm

So I am trying to call the active user in my hotspot through an API call. The problem I am having is that there is I can only get the first 100 or so before it terminates. How can I get the complete list of active hotspot users through an api call?

Thanks
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Limit to API Call

Fri May 11, 2018 8:25 pm

It's possible that the API client you're using isn't handling the network buffers well, so by the time it's finished processing what it has, the incoming packets have timed out, and it's not retrying. Or another possibility is that you have so many users in your client device's memory, that it can't fit all users in it, so it simply fails to insert new ones beyond a point.

Dealing with either of those is client specific though, so I can't help without you telling what language and API client you're using.

Another client agnostic way you can do... You could do one "find" call to get all users' IDs, in a ";" separated list. Split it, and loop over it. For each user ID, call a "print" with a "from" argument having that ID.

This is very time inefficient for a small number of users, because each API call is the most costly part, but it is very memory efficient, because each reply contains only one item and can be discarded as soon as the next one comes in.
 
electravis
Member Candidate
Member Candidate
Topic Author
Posts: 274
Joined: Tue Jan 26, 2010 12:06 am

Re: Limit to API Call

Wed Jun 20, 2018 9:22 pm

Yes yesterday I found newer api code when working on a different problem which also resolved this issue as well.

Who is online

Users browsing this forum: No registered users and 42 guests