OPNsense Forum
Archive => 19.1 Legacy Series => Topic started by: GaardenZwerch on February 20, 2019, 03:11:11 pm
-
Hi,
sorry for crossposting, I answered to a thread in 18.7 (https://forum.opnsense.org/index.php?topic=10802.0 (https://forum.opnsense.org/index.php?topic=10802.0)), but this should probably go in here as this api has evolved in 19.1
So, what is wrong with the following code?
url = 'http://192.168.122.230/api/firewall/alias/addItem/xyzzy'
headers = {'Content-Type': 'application/json'}
r = requests.post(url,
headers=headers,
data='{"name":"xyzzy","content":"192.168.5.5","enabled":"1","type":"host"}',
verify=False, #'/home/fweis/Documents/2019/OPNSense',
auth=(api_key, api_secret))
I also tried this, same result:
r = requests.post(url,
json={'name':'xyzzy','content':'192.168.5.5','enabled':'1','type':'host'},
verify=False,
auth=(api_key, api_secret))
Also, where can I find a list of actions in the alias api?
Thanks,
Frank