1
22.7 Legacy Series / Re: Firewall API to manage Destination based NAT Port Forwarding
« on: September 18, 2022, 08:03:27 pm »
For those who find this post and are having difficulty calling an OPNsense API, below is a full curl command posting data for reference:
The response you should get states:
Lots of people refer to it, but never in its full form in this forum. Hopefully will help others over time.
Code: [Select]
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:
Code: [Select]
{
"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.