aleab
July 22, 2022, 7:58pm
1
Hello,
i find api and i try to check netwatch with api
i’m able to read system resource with
curl -k -u admin:password https://192.168.88.1/rest/system/resource
but i want “read” netwatch status, so i try
curl -k -u admin:password https://192.168.88.1/rest/tool/netwatch/print
but i receive bad request
my goal is “read” up with ros command
:put ([/tool netwatch print as-value where host=8.8.4.4]->0->“status”);
or where comment = “WAN2”
can i use api instead ssh command?
thank you
Better late than never, and for the next visitors:
curl -k -u admin:password http://192.168.88.1:8080/rest/tool/netwatch
I’m using port 8080, because that’s where it’s listening for me as port 80 is already in use for Apache.
Amm0
September 13, 2024, 2:13pm
3
And the 2nd example would need to use a POST, not a GET (which is curl’s default HTTP method). In RouterOS REST API, the POST method mimics the native API. For curl you need a “-X POST” to use the more CLI commands like print:
curl -k -u admin:password -X POST https://192.168.88.1:443/rest/tool/netwatch/print
Of course web-ssl needs to be enabled with a certificate for https to work.