You can use the VMware Cloud Director 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 VMware Cloud Director 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 VMware Cloud Director API entityResolver URL to retrieve a context-free representation of the underlying object as an Entity element. The Entity includes a Link element for each currently valid reference to the object identified by the id specified in the request.

Prerequisites

Verify that you are logged in to the VMware Cloud Director API.Verify that you are logged in to the VMware Cloud Director API endpoint.

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, which includes a link to the entityResolver.
    <Session ... >
      ...
        <Link
          rel="entityResolver"
          type="application/vnd.vmware.vcloud.entity+xml"
          href="https://vcloud.example.com/api/entity/" />
    </Session>
  2. Retrieve the object whose id you want to resolve and find the value of its id attribute.
    See the request portion of Using the entityResolver URL.
  3. Append the value of the object's id attribute to the entityResolver URL.
  4. Make a GET request to the URL you created in Step 3
    See the request portion of Using the entityResolver URL.

Example: Using the entityResolver URL

This example retrieves the organization object shown in Object id, type, and href Attributes as an Entity.

Request:
GET https://vcloud.example.com/api/entity/urn:vcloud:org:72fe715c-5f6a-407f-bbb2-bf465915b5f4

This response includes two Link elements, each of which provides a valid href to the object identified by the id specified in the request.

Response:
<Entity
   xmlns="http://www.vmware.com/vcloud/v1.5"
   id="urn:vcloud:org:72fe715c-5f6a-407f-bbb2-bf465915b5f4"
   name="urn:vcloud:org:72fe715c-5f6a-407f-bbb2-bf465915b5f4"
   type="application/vnd.vmware.vcloud.entity+xml"
   href="https://vcloud.example.com/api/entity/urn:vcloud:org:72fe715c-5f6a-407f-bbb2-bf465915b5f4"
   ...>
   <Link
      rel="alternate"
      type="application/vnd.vmware.vcloud.organization+xml"
      href="https://vcloud.example.com/api/org/72fe715c-5f6a-407f-bbb2-bf465915b5f4"/>
   <Link
      rel="alternate"
      type="application/vnd.vmware.vcloud.admin.organization+xml"
      href="https://vcloud.example.com/api/admin/org/72fe715c-5f6a-407f-bbb2-bf465915b5f4"/>
</Entity>