I am trying to use fetch to pull down the contents of an array, and then retrieve elements of it for later use. It looks like it should work, but the best I can tell it's not recognizing the data in an array format and treating it like a single string, and thus no element data gets returned.
Code: Select all
:local strData {[:toarray ([/tool fetch mode=https output=user url="https://myserver.com/getvalues" as-value ]->"data")]}
Code: Select all
{ssid="network";username="test@domain";pass="mypass123"}
Code: Select all
:local strData {[:toarray ([/tool fetch mode=https output=user url="https://myserver.com/getvalues" as-value ]->"data")]}
:put $strData
:put "The Password is $($strData->"pass")"
[admin@RouterOS] /system script> run test
ssid="network";username="test@domain";pass="mypass123"
The Password is
Code: Select all
:local strData {ssid="network";username="testuser";pass="mypass123"}
:put "The Password is $($strData->"pass")"
[admin@RouterOS] /system script> run test
The Password is mypass123