OPNsense Forum
Archive => 21.1 Legacy Series => Topic started by: dym8 on June 29, 2021, 08:38:54 am
-
Hello.
I heed to disable one of my routes by API. I run this command
curl -X POST -d '{"disabled":"1"}' -H "Content-Type: application/json" -k -u %KEY%:%SECRET% https://10.10.1.1/api/routes/routes/toggleroute/2c7375ab-2500-45a5-a952-50c34ea26b9d
and got {"result":"Disabled"}
But then I run this command again I got {"result":"Enabled"}
I run the one again and got {"result":"Disabled"}
Why? I thought I have to change command to {"disabled":"0"} for enabling. No?
-
The action name is "toggleroute" which doesn't read your POST data and instead just flips the value?
You can probably also edit the route entry itself which gives you a more consistent behaviour from your perspective...
Cheers,
Franco
-
The toggle calls may support that you add /0 or /1 to the end of the URL to enable or disable the object.