Detach Volumes From Virtual Machine
POST https://infrahub-api.nexgencloud.com/v1/core/virtual-machines/{virtual_machine_id}/detach-volumes
Detaches one or more volumes currently attached to a virtual machine. Include the virtual machine ID in the path and the volume IDs in the request body to detach the specified volumes from the designated virtual machine.
Path parameters
virtual_machine_id integer
Required
The ID of the virtual machine the volumes are being detached from.
Request body parameters
volume_ids array of integers
Required
Specify one or more IDs of the volumes to be detached from the virtual machine.
Attributes
status boolean
Indicates the status of the volume detachment request. A status of true
indicates success.
message string
A message describing the status of the volume detachment.
volume_attachments array
An array consisting of details on each of the volumes that remain attached to the virtual machine.
To learn more about the attributes of the volumes_attachments
objects, click here.
curl -X POST "https://infrahub-api.nexgencloud.com/v1/core/virtual-machines/{virtual_machine_id}/detach-volumes" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"volume_ids": [
0
]
}'
{
"status": true,
"message": "string",
"volume_attachments": [
{
"id": 0,
"instance_id": 0,
"volume_id": 0,
"status": "string",
"created_at": "1970-01-01T00:00:00.000Z"
}
]
}
Returns
A successful response returns a status of true
, along with a confirmation message
and the volume_attachments
array of objects. Each object in the array provides details about a volume attached to the specified virtual machine. Any other response indicates an error has occurred.