Proxmox HTTP API Firewall - Doesn't return any optional values

RaephRaeph

New Member
May 4, 2021
1
0
1
23
Hello!
I need to get the firewall options from all my VMs via an API call. I found out that the optional parameters are not sent at all when they are at the default values.
But the API Viewer shows the default values just for dhcp, enable, macfilter, ndp as boolean 0. The other parameters have no default value according to the page
Proxmox Viewer Firewall Options.png
When I change one parameter once it will be always shown in the API response. Also if I change it back to the default it is shown. Is there somehow a possibility to always get the value also when they never got changed? I would need to get all the settings to store them.

Example:
This are just default values. I never changed anything!GET /api2/json/nodes/{node}/qemu/{vmid}/firewall/options
RESPONSE: {"data":{"digest":"da39a3ee5e6b4b0d3255bfef95601890afd80709"}}
Default Settings.png
When I change one setting to something else than the defaultGET /api2/json/nodes/{node}/qemu/{vmid}/firewall/options
RESPONSE: {"data":{"digest":"8e5f02233dcd8bbc6a8471ef11239a113b79f1f6","policy_out":"DROP"}}
One thing changed.png
When I change the value back to defaultGET /api2/json/nodes/{node}/qemu/{vmid}/firewall/options
RESPONSE: {"data":{"digest":"081b176c73032674dcddbc8412e74a7c1fb0b843","policy_out":"ACCEPT"}}
changed back to default.png

The same behavior I have for all values here.

Is there a way to always get all values also when they are optional?

Br.
 

Stefan_R

Proxmox Staff Member
Staff member
Jun 4, 2019
1,300
276
88
Vienna
No, default values are never returned. This is currently not implemented.

The reason why you still get the value after changing it back to the default is that it will still be stored in the config file under /etc/pve/firewall/. Remove it from there and you will go back to your first example.

If it helps, you can find a JSON representation of our API schema (including default values) here: https://git.proxmox.com/?p=pve-docs.git;a=blob;f=api-viewer/apidata.js
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!