Hello,
i try to check with rest api total wifi clients.
for now i’m testing on my HAP ax2 with ROS 7.9.
so on mikrotik i use
/interface/wifiwave2/registration-table/print count-only where ssid=“WIFI GUEST”
but with rest api i try to use
curl -k -u admin:12345678 -X POST https://10.2.1.1:10443/rest/interface/wifiwave2/registration-table/print
i see correct all wifi client (on all ssid)
curl -k -u admin:12345678 -X POST https://10.2.1.1:10443/rest/interface/wifiwave2/registration-table/print --data ‘{“.query”: [“ssid=WIFI GUEST”]}’ -H “content-type: application/json”
to try now i use m laptop windows 11, and i have this error
{“detail”:“Invalid JSON”,“error”:400,“message”:“Bad Request”}curl: (3) bad range in URL position 2:
[ssid=WIFI GUEST]}’
^
and i can’t found documentation to use command “count-only”
can you help me?
I think quotes will actually break it… It’s already in it’s own element so the “=” is separator for attributes, and next array element is next thing, so spaces shouldn’t be an issue.
You first example should work, but doesn’t for me either.
But using the “…/getall”, instead of “…/print” in URL does allow the “.query” string to work. The REST API’s POST methods really are just thin proxy over the “old” API, so all of this stuff largely applies to REST with POST: https://help.mikrotik.com/docs/display/ROS/API#API-Commanddescription
getall
getall command is available where console print command is available (getall is an alias for print).
replies contain =.id=Item internal number property.
To me it’s bug that “print with .query” doesn’t work… but I think the /getall will avoid. e.g. if it’s “alias for print” then it should do same thing, but here it doesn’t…