Update Virtual Machine Labels
PUT https://infrahub-api.nexgencloud.com/v1/core/virtual-machines/{virtual_machine_id}/label
Updates the labels for a specified virtual machine, allowing you to identify and organize your VMs.
Path parameters
virtual_machine_id integer
Required
The ID of the virtual machine for which the label is being modified.
Request body parameters
labels array of strings
Required
An array of labels to be applied to the specified virtual machine. To remove all labels, include an array of ""
.
Attributes
status boolean
Indicates the status of the request to update the virtual machine labels. A status of true
indicates success.
message string
A message describing the status of the labels update.
Example request
curl -X PUT "https://infrahub-api.nexgencloud.com/v1/core/virtual-machines/{virtual_machine_id}/label" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"labels": [
"example"
]
}'
Response
{
"status": true,
"message": "labels for VM: example-vm is set to: ['example']"
}
Returns
A successful response returns the status of true
and a message confirming that the new labels have been successfully applied to the virtual machine. Any other response indicates an error has occurred.