Hi All,
My goal is to create a script to enable/disable rules in forwarding chain and execute the script by API or API REST call. The script should accept a parameter in order to select the subnet to enable or disable.
Is this idea a good approach, a good way? Is it possible to run a script by API or API REST passing in some way a parameter?
In order to understand how to remotely execute a script passing it a parameter I did some simple test:
My test script:
script name: test-param
:global myvar Lab1:log info ("Parametro ricevuto: " . $myvar)
I am able to locally run the script:
/system/script/run number=test-param
I am able to set a the global variable myvar :
/system/script/environment/set numbers=myvar value=NewValue
Running the script I get the new variable value.
When I run the script by API or API REST I get the message but the variable myvar alwaise has the default value, Lab1. By API or API REST I am also able to set a new value for the variable myvar. The new value appear typing /system/script/environment/print but when I run the scriot by API, the variable myvar alwaise gets the default value.
Any suggestion will be appreciated!!
Thank a lot!