Hello,
I have this script added on mi mikrotik:
/ip firewall nat
enable 10
/routing bgp network
disable 12
:delay 600s
/ip firewall nat
disable 10
/routing bgp network
enable 12
When I run it from winbox it works fine
When I run it from PHP API it runs but it do nothing. (Like commands don´t work).
Run count increase everytime PHP API run the script so PHP is working okay.
Could anyone help me?
Don’t use numbers.
In the case of “actual” API calls, use “print” with a query that matches the item(s) you want affected, and get the ID from the “.id” property returned.
If you’ve just added and ran a script in “/system script”, then just use a nested “find” command in the script’s source (the actual API “find” commands don’t support queries, so you can’t get a specific item’s ID that way). That will return the item’s ID.
f.e.
/ip firewall nat
:local natItem10 [find where comment="item 10"]
enable $natItem10
/routing bgp network
:local bgpItem12 [find where comment="item 12"]
disable $bgpItem12
:delay 600s
/ip firewall nat
disable $natItem10
/routing bgp network
enable $bgpItem12