To retrieve the list of available portgroups and switches from a vCenter server registered to vCloud Director, make a GET request to the server's networks link.

Retrieving the networks link from a VimServer element returns a VimObjectRefList element that contains references to available DV_SWITCH, DV_PORTGOUP, and NETWORK objects on the server. Objects that have already been consumed in the creation of an external network are not listed. See Finding Available vCenter Resources.

This operation is restricted to system administrators.

1

Retrieve the XML representation of a vCenter server registered to vCloud Director.

2

Examine the response, a VimServer element, to locate the networks link.

This link has the following form:

<vcloud:Link
   rel="down"
   type="application/vnd.vmware.admin.vimServerNetworks+xml"
   href="https://vcloud.example.com/api/admin/extension/vimServer/9/networks" />
3

GET the URL in the value of this link's href attribute to retrieve the list of network resources.

See Example: Retrieve a List of Available Portgroups and Switches from a vCenter Server. If the list is empty, all network resources on the server are already in use.

Request:

GET https://vcloud.example.com/api/admin/extension/vimServer/9/networks

Response:

200 OK
Content-Type: application/vnd.vmware.admin.vimservernetworks+xml
...
<vmext:VimObjectRefList
   xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
   xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" ... >
   <vcloud:Link
      rel="up"
      type="application/vnd.vmware.admin.vmwvirtualcenter+xml"
      href="https://vcloud.example.com/api/admin/extension/vimServer/9" />
   <vmext:VimObjectRefs>
      <vmext:VimObjectRef>
         <vmext:VimServerRef
            type="application/vnd.vmware.admin.vmwvirtualcenter+xml"
            name="vc9"
            href="https://vcloud.example.com/api/admin/extension/vimServer/9" />
         <vmext:MoRef>dvportgroup-32</vmext:MoRef>
         <vmext:VimObjectType>DV_PORTGROUP</vmext:VimObjectType>
      </vmext:VimObjectRef>
      <vmext:VimObjectRef>
         <vmext:VimServerRef
            type="application/vnd.vmware.admin.vmwvirtualcenter+xml"
            name="vc9"
            href="https://vcloud.example.com/api/admin/extension/vimServer/9" />
         <vmext:MoRef>dvportgroup-175</vmext:MoRef>
         <vmext:VimObjectType>DV_PORTGROUP</vmext:VimObjectType>
      </vmext:VimObjectRef>
   </vmext:VimObjectRefs>
</vmext:VimObjectRefList>