import requestskey='my_key'secret='my_secret'endpoint = "https://[host]/api/firewall/alias_util/add/bogons"r = requests.post(url=endpoint, auth=(key, secret), json={'address': '0.0.0.0/8'})print (r.status_code, r.text)
It's actually pretty simple, if it works in the browser, the same call will also work using the api.A simple example using python, looks like this:Code: [Select]import requestskey='my_key'secret='my_secret'endpoint = "https://[host]/api/firewall/alias_util/add/bogons"r = requests.post(url=endpoint, auth=(key, secret), json={'address': '0.0.0.0/8'})print (r.status_code, r.text)Which will add 0.0.0.0/8 to the alias named bogons.
I tried curl and PostMan, same in both. Adding one address in manually through the UI lets the API work immediately so its not that big a deal (in my opinion).
... I wrote the code in OPNsense, there is a chance I know what it's for Both endpoints serve a different purpose, the util endpoint is effectuated immediately, the other one only changes the configuration content and needs a different payload (just look in the user interface how it should look, like suggested earlier).