Scan wireless networks using API for Java

Hello,

I am trying to make one app for remote scanning but i can´t find the correct command. Using the CLI I use this one:
interface wireless scan number=0

With the API I have tried with this one:
ret.sendCommand(“/interface/wireless/scan=.number=*2”);

When *2 i get from this command:
interface wireless
:put [find];

But unfortunately the answer is:

Mikrotik:
!trap
=message=no such command
Mikrotik:
!done

Does anyone know what is the correct command?

Thank you!

command should be

/interface/wireless/scan
=.id=*2

that is, if you want to do scan with interface that .id number is *2 and the item exist.

Better get .id using API to get the permanent static item number.

or, just use this:

/interface/wireless/scan
=.id=wlan1

yes, you can use item name to identify it, just check before you use that, as i have tested a lot of name uses as .id value, but i cannot be 100% sure i have tested them all.

          ret.sendCommand("/interface/wireless/scan"
               + "=.id=wlan1");

The same response:

run:
Mikrotik:
!trap
=message=no such command
Mikrotik:
!done