API problem in 4.8

Running across a problem with viewing interface traffic statistics in new version 4.8. I try:
<<< /interface/print
<<< ?name=ether1
<<<

And I get

!re
=.id=*1
=name=ether1
=type=ether
=mtu=1500
=l2mtu=1524
=dynamic=false
=running=true
=disabled=false
=comment=

In version 4.5 I get returned parameters “bytes” and “packets” along with everything else.

!re
=.id=*1
=name=ether1
=type=ether
=mtu=1500
=l2mtu=1526
=bytes=284609182/413275649
=packets=1307889/766476
=dynamic=false
=running=true
=disabled=false
=comment=


Is this information not available anymore in 4.8 API? Did it move? Would be great to get it back.

Thank you,

Same issue here, my munin script drawing the interface graph does not collect any data anymore ):

at this moment you can try this command

/interface/print
=stats=
?name=ether1

not the =stats=

result on RB450G is:

!re
=.id=*1
=name=ether1
=type=ether
=mtu=1500
=l2mtu=1524
=bytes=13645510/211566156
=packets=145917/163922
=drops=0/0
=errors=0/0
=dynamic=false
=running=true
=disabled=false

i will check where this change crept in. On the other hand it does make sense that errors and other stats are showed when =stats= are added. BTW this behaviour is on both 4.8 and 5.0beta2 (due to be released someday)

The =stats= sentence works on 4.5 and 4.8. Will change the code behind our app.

Thanks!

The =stats= sentence worked for interfaces, but I am having this problem now with /ip/hotspot/host/print.

<<< /ip/hotspot/host/print
<<< =stats=
<<<
Sentence iLength = 2
Sentence iReturnValue = 2

!trap
=message=unknown parameter

The =stats= sentence doesn’t work and the bytes and packets stats don’t display. Is there a command to show the user stats in hotspot using API?

I am able to get bytes and packets from /ip/hotspot/active/print by using =stats= sentence, but that only works for hotspot users that are logged in. I also tried new version 4.9 today and same problem.

This makes sense to me, as it closely relates to the console commands.

Ex.
/interface print
/interface print stats
/ip hotspot active print stats
/ip hotspot host print stats
/ip hotspot host print bytes
/ip hotspot host print packets

Try with the ‘packets’ and ‘bytes’. This should be the expected behavior.

Thank you much dssmiktik. Using the =bytes= sentence gives me everything like =stats= does. This should work for my API application.

Does anybody know if this is the expected behavior of API? Is there a plan to change it in future revisions? Will =stats= sentence be added in for /ip/hotspot/host/print sentence?

<<< /ip/hotspot/host/print
<<< =bytes=
<<<
Sentence iLength = 20
Sentence iReturnValue = 0

!re
=.id=*1
=mac-address=00:40:05:53:A2:5A
=address=192.168.0.19
=to-address=192.168.0.19
=server=hotspot1
=uptime=2d03:35:49
=idle-time=00:00:12
=idle-timeout=01:00:00
=keepalive-timeout=01:00:00
=host-dead-time=00:00:12
=bridge-port=ether3
=bytes-in=171696
=bytes-out=171696
=packets-in=3066
=packets-out=3066
=found-by=ARP reply to 192.168.0.1
=authorized=false
=bypassed=true
=comment=type:device;Dlink AP


Thank you.

Now I’m having problems getting .id property from /ip/route/print command. I’ve tried =detail=, =stats=, =bytes=, and =packets= but I can’t get .id property from /ip/route/print using API. I also found that /ip/dns has changed.

Is there a help or changelog file somewhere detailing what has changed from 4.5 to 4.9? The changelog from the download page is very vague. My app is really broken when I try routeros 4.9. I have no idea what has changed and it is really frustrating. :frowning:

I just ran into this problem. This thread saved my mind.

I’ve been using api for a web based app with ROS <=4.6 for many months.

I installed some new devices recently with 4.10 and the web app is missing hotspot ‘bytes’ and other information.

adding =bytes= to the command works.

Thanks!

I would volunteer to help keep an api wiki up to date, BUT I WILL NOT do it using trial and error with API commands.
It is way too time consuming.

I have had to resort to trial and error to write my apps, because the documentation is severely lacking for API and it DOES NOT always follow the terminal commands, as we have seen.

Someone has the api source code and knows what commands result in what data!

v4.10 fixed the route print problem (not sure about dns):

*) api - fixed ‘/ip/route/print’, was not showing ‘.id’ values;