OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 19.1 Legacy Series »
  • Aliases API
« previous next »
  • Print
Pages: [1]

Author Topic: Aliases API  (Read 2660 times)

GaardenZwerch

  • Full Member
  • ***
  • Posts: 104
  • Karma: 2
    • View Profile
Aliases API
« 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), but this should probably go in here as this api has evolved in 19.1


So, what is wrong with the following code?
 
Code: [Select]

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:

Code: [Select]
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
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 19.1 Legacy Series »
  • Aliases API
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2