5.1

Table Of Contents
Retrieve an Object as an Entity
You can use the vCloud API entity resolver with an object's id attribute value to retrieve a context-free reference
to the object.
Every first-class object that the vCloud API defines includes an id attribute whose value is the object identifier
expressed in URN format. The value of the id attribute uniquely identifies the object, persists for the life of the
object, and is never reused.
You can append the value of the id attribute to the vCloud API entityResolver URL to retrieve a context-free
representation of the underlying object as an Entity element.
Prerequisites
Verify that you are logged in to the vCloud API as a system administrator or member of an organization in
the cloud.
Procedure
1 Retrieve the current Session object to get the entityResolver URL.
Use a request like this one:
GET https://vcloud.example.com/api/session
The response is a Session element like the one shown in “Example: Create a Login Session Using the
Integrated Identity Provider,” on page 45. The Session element contains the entityResolver URL in the
href of the Link element in this excerpt.
<Session ... >
...
<Link
rel="entityResolver"
type="application/vnd.vmware.vcloud.entity+xml"
href="https://vcloud.example.com/api/entity/" />
</Session>
2 Append the value of the object's id attribute to the entityResolver URL.
3 Make a GET request to the URL you created in Step 2
See the request portion of “Example: Using the entityResolver URL,” on page 312.
Example: Using the entityResolver URL
This example retrieves the Vapp object shown in the excerpt “Example: Object id, type, and href Attributes,”
on page 12 as an Entity.
Request:
GET https://vcloud.example.com/api/entity/urn:vcloud:vapp:490af534-1491-452e-8ed6-a5eb54447dac
Response:
<Entity
xmlns="http://www.vmware.com/vcloud/v1.5"
id="urn:vcloud:vapp:490af534-1491-452e-8ed6-a5eb54447dac"
name="urn:vcloud:vapp:490af534-1491-452e-8ed6-a5eb54447dac"
type="application/vnd.vmware.vcloud.entity+xml"
href="https://vcloud.example.com/api/entity/urn:vcloud:vapp:490af534-1491-452e-8ed6-
a5eb54447dac"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...>
vCloud API Programming Guide
312 VMware, Inc.