Community discussions

MikroTik App
 
hrico
just joined
Topic Author
Posts: 12
Joined: Wed Dec 16, 2009 2:25 am

API interface IDs

Wed May 05, 2010 12:10 pm

In my API in order to use
/interface/wireless/scan
=.id=*4


I tried to find out ids of my interfaces:
[admin@Mikrotik] /interface> :put [find]
*1;*2;*3;*9;*b;*c;*e;*f


1-3 are Ethernet interfaces
b,c is supposed to be wireless
and the rest are bridges.

Shouldn't be there a list of id from 1 to 8?
Why cant I use:
/interface/wireless/scan
=.id=*b

... I always get this:
!trap=message=no such command prefix
!done


And last question: In RouterOS, what is the difference between ids mentioned above and those which are listed on the left when you do /interface print command? Why can't I use those in API?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7041
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: API interface IDs

Wed May 05, 2010 1:01 pm

IDs displayed in console when you use print command is order numbers of each item. Those order numbers can be different depending on what you are printing

for example I run print command and get ether3 with order number 0
/interface ethernet print where name="ether3"
Flags: X - disabled, R - running, S - slave
 #    NAME                                  MTU   MAC-ADDRESS       ARP        MASTER-PORT                                SWITCH
 0 R  ether3                                1500
Now I run print to get all items
/interface ethernet print
Flags: X - disabled, R - running, S - slave
 #    NAME                                  MTU   MAC-ADDRESS       ARP        MASTER-PORT                                SWITCH
 0 R  ether1                                1500 
 1    ether2                                1500   
 2 R  ether3                                1500
Notice that now ether3 has different order number so you can't use it from API in any way.

That is why each item has unique internal ID number which is assigned to each item.

Who is online

Users browsing this forum: 4l4R1, Ahrefs [Bot], iustin, kivimart, lurker888, NetHorror, smirgo and 82 guests