Community discussions

MikroTik App
 
DanielT
just joined
Topic Author
Posts: 15
Joined: Wed Dec 13, 2017 6:55 pm

Retrieve hotspot active users via API

Wed Jun 07, 2023 3:01 pm

Hi

I'm trying to grab hotspot active users via the API

I would normally use /ip/hotspot/active/print count-only, but can't figure a cURL API call to replicate

Tried the following:

curl -k -u admin:password http://10.8.0.66/rest/ip/hotspot/active ... count-only

curl -k -u admin:password http://10.8.0.66/rest/ip/hotspot/active/print\
--data '{"_proplist": ["count-only"]}' -H "content-type: application/json"

curl -k -u admin:password http://10.8.0.66/rest/ip/hotspot/active ... count-only

But all return {"detail":"no such command","error":400,"message":"Bad Request"}

Any advice well appreciated.

(PS I know http method is insecure, but I am requesting over my TLS OpenVPN connex)

Thanks
 
zainarbani
Frequent Visitor
Frequent Visitor
Posts: 54
Joined: Thu Jul 22, 2021 9:42 am
Location: Pati, Indonesia

Re: Retrieve hotspot active users via API

Wed Jun 07, 2023 7:49 pm

# Unix
curl -k -u admin:password http://10.8.0.66/rest/ip/hotspot/active/print\
 -X POST --data '{"count-only": ""}' -H "content-type: application/json"

# Win
curl -k -u admin:password http://10.8.0.66/rest/ip/hotspot/active/print\
 -X POST --data "{\"count-only\": \"\"}" -H "content-type: application/json"

 
DanielT
just joined
Topic Author
Posts: 15
Joined: Wed Dec 13, 2017 6:55 pm

Re: Retrieve hotspot active users via API

Thu Jun 08, 2023 11:25 am

Thanks Zainarbani,

That works PERFECTLY!

Daniel

Who is online

Users browsing this forum: No registered users and 21 guests