Each name=value
pair in an object's metadata is represented as a MetadataEntry element, which includes links that an administrator or the object owner can use to retrieve or update the metadata value, or delete the MetadataEntry.
Prerequisites
-
Verify that you are logged in to the VMware Cloud Director API as an administrator or the object owner. Verify that you are logged in to the vCloud Air Compute Service as a Virtual Infrastructure Administrator or the End User who owns this object.
- Retrieve the object's Metadata element. See Retrieve or Update a Metadata Element
Procedure
Example: Update a Metadata Value
This request updates the value of the metadata Key named LOS
from the original value of bronze
(shown in Update a Metadata Element) to a new value of silver
. Note that because this MetadataValue is contained by a MetadataEntry where the Domain is SYSTEM and visibility is PRIVATE, only a system administrator can update it.
PUT https://vcloud.example.com/api/admin/org/26/metadata/SYSTEM/LOS Content-Type: application/vnd.vmware.vcloud.metadata.value+xml ... <?xml version="1.0" encoding="UTF-8"?> <MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <TypedValue xsi:type="MetadataStringValue"> <Value>silver</Value> </TypedValue> </MetadataValue>
This request updates the value of the metadata Key named PenTested
from the original value of false
(shown in Update a Metadata Element) to a new value of true
.
PUT https://vcloud.example.com/api/vApp/vapp-7/metadata/PenTested Content-Type: application/vnd.vmware.vcloud.metadata.value+xml ... <?xml version="1.0" encoding="UTF-8"?> <MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <TypedValue xsi:type="MetadataBooleanValue"> <Value>true</Value> </TypedValue> </MetadataValue>
The response is a task.
<Task xmlns="http://www.vmware.com/vcloud/v1.5" status="running" ... operationName="metadataUpdate" operation="Updating metadata for vApp (7)" ... > ... </Task>