5.1

Table Of Contents
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,” on page 74 for an example.
6 POST the CatalogItem body to the catalog's rel="add" URL.
Step 4 explains how to find this URL.
Example: ResourceEntity and Corresponding CatalogItem
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.
n
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.
n
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.
n
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,” on page 29. 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
vCloud API Programming Guide
74 VMware, Inc.