Community discussions

MikroTik App
 
idmytrenko
just joined
Topic Author
Posts: 3
Joined: Mon Dec 28, 2020 5:23 pm

Difference between labels and functions

Mon Jan 11, 2021 4:51 pm

Hello, dear Sirs, I need help.
When you want to execute a command in the mikrotik terminal, you need to escape the question marks with backslash \?
:local result [/tool fetch mode=https url="https://10.10.10.10/xml/json.php\?mode=all&id=102" http-method=get user=username password=password  as-value output=user port=443;]; :local varData ( $result->"data" ); :put [:pick $varData 305  310];
when executing ros_command from dude, you must additionally escape the doublequotes \".
[ros_command(":local result [/tool fetch mode=https url=\"https://10.10.10.10/xml/json.php\?mode=all&id=102\" http-method=get user=username password=password  as-value output=user port=443;]; :local varData ( $result->\"data\" ); :put [:pick $varData 305  310]; ")]
It works fine on the device labels.
Now I want to put it all into a dude function, but I get a parce error.
Who knows the differences between labels and dude functions syntax?
 
idmytrenko
just joined
Topic Author
Posts: 3
Joined: Mon Dec 28, 2020 5:23 pm

Re: Difference between labels and functions

Mon Jan 11, 2021 6:22 pm

The difference is that square brackets are not required, lol
ros_command(":local result [/tool fetch mode=https url=\"https://10.10.10.10/xml/json.php\?mode=all&id=102\" http-method=get user=username password=password  as-value output=user port=443;]; :local varData ( $result->\"data\" ); :put [:pick $varData 305  310]; ")

Who is online

Users browsing this forum: mohas2, th3bulldozer and 21 guests