Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - JamesElstone

#1
For those who find this post and are having difficulty calling an OPNsense API, below is a full curl command posting data for reference:

curl \
-XPOST \
-H "Content-Type: application/json" \
-d '{"host": {"enabled":"1","hostname":"test","domain":"example.com","rr":"A","server":"1.2.3.4","description":"A test"}}' \
-k \
-u "yourAPIkey":"yourAPIsecret" \
https://opnsense.ip.address.or.dns.name/api/unbound/settings/addHostOverride/


The response you should get states:
{
  "result":"saved",
  "uuid":"guid_id_of_object_created"
}


Lots of people refer to it, but never in its full form in this forum. Hopefully will help others over time.
#2
Hi OPNsense Forum,

I have read up on the both the Core API and the "Firewall" plugin API, and can only find the controller for  "source_nat" that is documented.

I am wanting to dynamically control the the NAT -> Port Forward table via the API.

Also when I call the /api/firewall/filter_base/get API, it returns an API exception error: [internal function]: Phalcon\\Di\\Di->get('OPNsense\\\\Firewa...', NULL)

Has someone any domain knowledge in this area or can help me with this please?