ServerMania logo

Delete Firewall Rule

Ensure that the following permissions are enabled before setting firewall rules for your virtual server:

  • Create own firewall rules
  • Destroy own firewall rules
  • Read own firewall rules
  • Update own firewall rules

To delete a firewall rule, use the following request:

DELETE /virtual_machines/:virtual_machine_id/firewall_rules/:id.xml
DELETE /virtual_machines/:virtual_machine_id/firewall_rules/:id.json

XML Request Example

curl -i -X DELETE -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass --url http://test/virtual_machines/23/firewall_rules/21.xml

JSON Request example

curl -i -X DELETE -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass --url http://test/virtual_machines/23/firewall_rules/21.json

To destroy several firewall rules, use the following request:

DELETE /virtual_machines/:virtual_machine_id/firewall_rules/destroy_batch?ids=1,2,3.xml
DELETE /virtual_machines/:virtual_machine_id/firewall_rules/destroy_batch?ids=1,2,3.json

XML Request Example

curl -X DELETE -u user:userpass http://test/virtual_machines/omxa18ecx5e5y1/firewall_rules/destroy_batch.xml?ids=24,25 -H 'Accept: application/xml' -H 'Content-type: application/xml'

JSON Request Example

curl -X DELETE -u user:userpass http://test/virtual_machines/omxa18ecx5e5y1/firewall_rules/destroy_batch.json?ids=20,22 -H 'Accept: application/json' -H 'Content-type: application/json'


You will get a 204 status response on success, and 404 if there is no firewall rule with a requested ID or you entered incorrect URL.