ServerMania logo

Unassign IP Address from VS

To delete an IP address assignment from a particular VS, you have to remove the IP and rebuild the network. There are two API calls for IP deletion: one unassigns an address, but actually leaves it on a VS, and the second removes the address, rebuilds the network and thus reboots a VS.
To delete an IP address without rebuilding a network, use the following request:

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

XML Request Example

curl -i -X DELETE -u user:userpass —url http://test/virtual_machines/12/ip_addresses/2.xml

JSON Request Example

curl -i -X DELETE -u user:userpass —url http://test/virtual_machines/12/ip_addresses/2.json

To delete an IP address and rebuild a network, use the following request:

DELETE /virtual_machines/:virtual_machine_id/ip_addresses/:id.xml?rebuild_network=1
DELETE /virtual_machines/:virtual_machine_id/ip_addresses/:id.json?rebuild_network=1

XML Request Example

curl -i -X DELETE -u user:userpass —url http://test/virtual_machines/12/ip_addresses/2.xml?rebuild_network=1

JSON Request Example

curl -i -X DELETE -u user:userpass —url http://test/virtual_machines/12/ip_addresses/2.json?rebuild_network=1

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