5.5

Table Of Contents
2 Examine the response to find the Link for adding extension services.
This URL is present in the VMWExtension element, and has the following form.
<vcloud:Link
rel="down"
type="application/vnd.vmware.admin.extensionServices+xml"
href="https://vcloud.example.com/api/admin/extension/service"/>
3 Construct a Service element.
See the request portion of “Example: Register an Extension Service,” on page 333.
4 POST the Service element to the URL described in Step 2.
See the request portion of “Example: Register an Extension Service,” on page 333.
Example: Register an Extension Service
This request registers an extension service named SDK-BackupExtension. The request specifies the service
namespace and routing key, and several URL patterns to be used as API filters. Messages for the service are
sent to the AMQP exchange named sdkext with routing key sdkbackup.
NOTE If the specified exchange does not exist on the AMQP service that vCloud Director uses, an internal
server error occurs whenever vCloud Director receives a request that matches one of the service's API filters.
This request also includes several ServiceLink elements. For information about the contents of these
elements, see “Adding or Removing Service Links,” on page 336.
Request:
POST https://vcloud.example.com/api/admin/extension/service
Content Type: application/vnd.vmware.admin.service+xml
<?xml version="1.0" encoding="UTF-8"?>
<vmext:Service
xmlns="http://www.vmware.com/vcloud/v1.5"
xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
name="SDK-BackupExtension">
<vmext:Namespace>org.example.vcd.backup</vmext:Namespace>
<vmext:Enabled>true</vmext:Enabled>
<vmext:AuthorizationEnabled>true</vmext:AuthorizationEnabled>
<vmext:RoutingKey>backup</vmext:RoutingKey>
<vmext:Priority>50</vmext:Priority>
<vmext:Exchange>sdkext</vmext:Exchange>
<vmext:ApiFilters>
<vmext:ApiFilter>
<vmext:UrlPattern>(/api/org/.*/backups)|(/api/vApp/vapp-.*/backups)|
(/api/vApp/vapp-.*/action/backup)|(/api/backup/.*)</vmext:UrlPattern>
</vmext:ApiFilter>
</vmext:ApiFilters>
<vmext:ServiceLinks>
<vmext:ServiceLink>
<vmext:LinkHref>{baseUri}org/{resourceId}</vmext:LinkHref>
<vmext:MimeType>application/vnd.example.vcd-backup.backupList+xml</vmext:MimeType>
<vmext:Rel>down</vmext:Rel>
<vmext:ResourceType>application/vnd.example.vcd-backup.org+xml</vmext:ResourceType>
</vmext:ServiceLink>
<vmext:ServiceLink>
<vmext:LinkHref>{baseUri}api/vApp/vapp-{resourceId}/backups</vmext:LinkHref>
Chapter 11 vCloud Director Extension Services
VMware, Inc. 333