Enable Firewall API call failed with 501 not implemented

Feb 2, 2023
6
0
1
Hei folks,
I am trying to enable VM firewall via API call using ansible URI module
Code:
- name: Enable firewall
  ansible.builtin.uri:
    url: "{{ proxmox_url }}:8006/api2/json/nodes/{{ node }}/qemu/{{ vmid }}/firewall/options"
    method: POST
    headers:
      Authorization: "PVEAPIToken={{ api_user }}!{{ api_token_id }}={{ api_token_secret }}"
    body_format: form-urlencoded
    body:
    - [ enable, true ]

but getting error:

Code:
"msg": "Status code was 501 and not [200]: HTTP Error 501: Method 'POST /nodes/node/qemu/111/firewall/options' not implemented"

Another similar api call for adding rules set /firewall/rules works just fine.

Tried with [ enable, 1 ] as well, but no change.


Any idea?
Thx!
 
I am pretty sure I did PUT at first place and got 501 as well.
Now I am getting
Code:
 "errors": {"enable": "type check ('boolean') failed - got 'True'"}}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Parameter verification failed."

changed the body to [ enable, 1 ] seems to work.

Thanks!