A catalog can contain references to vApp templates and media images from any vDC in an organization. A vApp template or media image can be listed in at most one catalog.

Verify that you are logged in as a user with the Catalog Author role, as an organization administrator, or as a system administrator.

1

Retrieve the XML representation of your organization and look for links to the catalogs and vDCs it contains.

Links to catalogs have the following form:

<Link rel="down"
   type="application/vnd.vmware.vcloud.catalog+xml" 
   name="CatalogName" 
   href="https://vcloud.example.com/api/catalog/32"/>

Links to vDCs have the following form:

<Link rel="down"
   type="application/vnd.vmware.vcloud.vdc+xml" 
   name="vDCName" 
   href="https://vcloud.example.com/api/vdc/5"/>
2

Browse the vDCs in your organization to find the ResourceEntity element that represents the item to add to the catalog.

Resource entities are contained in the ResourceEntities element of a Vdc .

<Vdc
   xmlns="http://www.vmware.com/vcloud/v1.5"
   name="ExampleVdc01"
   type="application/vnd.vmware.vcloud.vdc+xml"
   href="https://vcloud.example.com/api/vdc/5">
   ... 
   <ResourceEntities>
      <ResourceEntity
         href="https://vcloud.example.com/api/vAppTemplate/vappTemplate-111"
         type="application/vnd.vmware.vcloud.vAppTemplate+xml"
         name="Ubuntu Template with vsftpd"/>
      <ResourceEntity
         type="application/vnd.vmware.vcloud.vAppTemplate+xml"
         name="NewVAppTemplate"
         href="https://vcloud.example.com/api/vAppTemplate/vappTemplate-559" />
      ...
   </ResourceEntities>
   ...
</Vdc>
3

Retrieve the XML representation of the catalog to which to add the item.

Use a request like this one:

GET https://vcloud.example.com/api/catalog/32
4

Examine the response to locate the Link element that contains the URL for adding items to the catalog.

This element has a rel attribute value of add and a type attribute value of application/vnd.vmware.admin.catalogItem+xml, as this example shows:

<Link
   rel="add" 
   type="application/vnd.vmware.admin.catalogItem+xml"
   href="https://vcloud.example.com/api/catalog/32/catalogItems"/>
5

Create a CatalogItem element that contains a reference to the ResourceEntity

See Example: ResourceEntity and Corresponding CatalogItem for an example.

6

POST the CatalogItem body to the catalog's rel="add" URL.

Step 4 explains how to find this URL.

This example starts with this ResourceEntity, which references a vApp template.

<ResourceEntity
   href="https://vcloud.example.com/api/vAppTemplate/vappTemplate-111"
   type="application/vnd.vmware.vcloud.vAppTemplate+xml"
   name="Ubuntu Template with vsftpd"/>

Follow these guidelines to create a CatalogItem from a ResourceEntity.

The name attribute of the CatalogItem can be the same as the one in the ResourceEntity, or you can make up a new value for name.

The Description element of the CatalogItem can be the same as the Description element for the object that the ResourceEntity element references, or you can create a Description element.

The href attribute of the Entity element in the CatalogItem must have the same value as the href attribute of the ResourceEntity that the CatalogItem references.

This request creates the catalog item that is retrieved in Example: Retrieve a Catalog Item. The response contains information extracted from the request, and includes links that an administrator or catalog owner can use to manage the CatalogItem.

Request:

POST https://vcloud.example.com/api/catalog/32/catalogItems
Content-Type: application/vnd.vmware.vcloud.catalogItem+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<CatalogItem
   name="Ubuntu Template with vsftpd"
   type="application/vnd.vmware.vcloud.catalogItem+xml"
   xmlns="http://www.vmware.com/vcloud/v1.5">
   <Description>Approved template for public FTP sites</Description>
   <Entity 
      href="https://vcloud.example.com/api/vAppTemplate/vappTemplate-111"/>
</CatalogItem>

Response:

200 OK
Content-Type: application/vnd.vmware.vcloud.catalogItem+xml
...
<CatalogItem
   xmlns="http://www.vmware.com/vcloud/v1.5"
   name="Ubuntu Template with vsftpd"
   id="urn:vcloud:catalogitem:221"
   href="https://vcloud.example.com/api/catalogItem/221" ... >
  <Link
      rel="up"
      type="application/vnd.vmware.vcloud.catalog+xml"
      href="https://vcloud.example.com/api/catalog/32" />
   <Link
      rel="down"
      type="application/vnd.vmware.vcloud.metadata+xml"
      href="https://vcloud.example.com/api/catalogItem/221/metadata" />
   <Link
      rel="edit"
      type="application/vnd.vmware.vcloud.catalogItem+xml"
      href="https://vcloud.example.com/api/catalogItem/221" />
   <Link
      rel="remove"
      href="https://vcloud.example.com/api/catalogItem/221" />
   <Description>Approved template for public FTP sites</Description>
   <Entity
      href="https://vcloud.example.com/api/vAppTemplate/vappTemplate-111"
      type="application/vnd.vmware.vcloud.vAppTemplate+xml"
      name="Ubuntu Template with vsftpd"/>
</CatalogItem>