1.5

Table Of Contents
Retrieve or Update a Metadata Value
Each
name
=
value
pair in an object's metadata is represented as a MetadataEntry element, which includes links
that a system administrator or object owner can use to retrieve or update the metadata value, or delete the
MetadataEntry.
Prerequisites
n
Verify that you are logged in as a system administrator or the object owner.
n
Retrieve the object's Metadata element. See “Retrieve or Update a Metadata Element,” on page 196
Procedure
1 Examine the retrieved Metadata element to find the Key you want.
Each key name is defined by the content of a Key element.
2 Retrieve or update the value.
Make a request to the URL in the value of the href attribute of the MetadataEntry that contains the Key.
(To modify the Key contents, you must update the entire Metadata element. See “Retrieve or Update a
Metadata Element,” on page 196.)
n
To retrieve the value, make a GET request to the URL. The response is a MetadataValue element.
n
To update the value, make a PUT request to the URL and supply a MetadataValue element as the
request body. See .“Example: Update a Metadata Value,” on page 199
NOTE If you know the name of a key (the content of a Key element), you can construct a URL to retrieve
its value by appending the key name to the object's metadata URL. The key name is case-sensitive. Any
special characters it contains must be appropriately escaped in the URL. See “vCloud API Object Metadata
Contents,” on page 195.
Example: Update a Metadata Value
This request updates the value of the metadata Key named LOS from the original value of bronze (shown in
“Example: Update a Metadata Element,” on page 197) to a new value of silver. The response is a task.
Request:
PUT https://vcloud.example.com/api/admin/org/26/metadata/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">
<Value>silver</Value>
</MetadataValue>
Response:
<Task
xmlns="http://www.vmware.com/vcloud/v1.5"
status="running"
...
operationName="metadataUpdate"
Chapter 8 Working With Object Metadata
VMware, Inc. 199