OPNsense Forum
Archive => 19.1 Legacy Series => Topic started by: gertfriend on March 15, 2019, 02:36:57 pm
-
Hello,
i have trouble with the API.
I use curl. For now the following commands work:
curl -k -u "key":"secret" https://192.168.1.1/api/core/firmware/status
and
curl -XPOST -d '{}' -H "Content-Type: application/json" -k -u "key":"secret" https://192.168.1.1/api/core/firmware/poweroff
But none of the following commands work:
curl -XPOST -d '{"upgrade":"all"}' -H "Content-Type: application/json" -k -u "key":"secret" https://192.168.1.1/api/core/firmware/upgrade
nor
curl -XPOST -d '{"address":"1.0.1.10"}' -H "Content-Type: application/json" -k -u "key":"secret" https://192.168.1.1/api/firewall/alias_util/add/BANNED
The result is always {"status":"failure"}.
And what should be posted to do a release update: 18.7 to 19.1
Thanks for any help
-
Sorry Franco, i didn't want nerve you and your team seen witch great work you do, i only thought that more people are using API and could help resolve the problem.
Now i resolved it. The problem was, that i was using curl from windows and windows has since ever trouble with quotas respectively double quotas so the solution for windowsuser is to enter change the -d in "{\"upgrade\":\"all\"}" so the single quotas should be replaced with double quotas and the double quotas will be escaped.
curl -XPOST -d "{\"upgrade\":\"all\"}" -H "Content-Type: application/json" -k -u "key":"secret" https://192.168.1.1/api/core/firmware/upgrade