API calls
The simplest way to test API calls is by using the curl
tool. You can install it on Linux, FreeBSD, macOS, and Windows. On Windows 10/11, it is installed by default. Choose your preferred OS and start testing!
We will need access to the OPNsense webGUI port for testing, so I recommend that you do the tests from the LAN network. Avoid keeping webGUI and SSH access open to the internet so that you don't use it from the WAN. It would be best if you used a VPN instead.
GET method example
We will use the following curl
parameters in this example:
Important Note
We are using the curl
and jq
parameters for Unix-like environments in the following steps. If you want to use it on another shell, such as Windows Powershell, the parameters and outputs may vary.
-k
: Allows insecure server connections when you're using TLS. Do not use this in a production environment! Consider using a trusted certificate instead.-u
:<user:password>
This is the...