You can add a service link to an existing service.

A ServiceLink element must contain the following child elements:

LinkHref

The value of href attribute of the Link. This can be any URI, and can include the variables {baseUri} and {resourceId}. When constructing the href value of the Link, vCloud Director replaces {baseUri} with the vCloud Director REST API base URL, and replaces {resourceId} with the UUID portion of the id attribute value of the resource in which the Link is inserted. The following example might expand to the string https://vcloud.example.com/org/17.

<LinkHref>
   {baseUri}/org/{resourceId}
</LinkHref>

MimeType

The value, specified as a MIME content type, of the type attribute of the Link.

Rel

Defines the relationship of the link to the object that contains it. A relationship can be the name of an operation on the object, a reference to a contained or containing object, or a reference to an alternate representation of the object. The relationship value implies the HTTP verb to use when you use the link's href value as a request URL.

ResourceType

The object type, specified as a MIME content type, of the object in which the Link appears.

Note

You can constrain the Link to appear in a specific resource by including a ResourceId element in the ServiceLink. This element contains the id of the resource in which the Link will appear. This resource must be of the type specified in the ResourceType element of the ServiceLink.

Verify that you are logged in to the vCloud API as a system administrator.

1

Retrieve the XML representation of the service.

This request retrieves the XML representation of the service created in Example: Register an Extension Service:

GET https://vcloud.example.com/api/admin/extension/service/45
2

Examine the response to find the Link for adding service links.

This Link has the following form:

<vcloud:Link
      rel="add"
      type="application/vnd.vmware.admin.serviceLink+xml"
      href="https://vcloud.example.com/api/admin/extension/service/44/links" />
3

Create a ServiceLink element that specifies the properties of the new link.

4

POST the ServiceLink element to the URL described in Step 2

See Example: Add a Service Link.

This request adds a ServiceLink to the service created in Example: Register an Extension Service

Request:

POST https://vcloud.example.com/api/admin/extension/service/45/links
Content-type: application/vnd.vmware.admin.serviceLink+xml
<?xml version="1.0" encoding="UTF-8"?>
<vmext:ServiceLink
   xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
   xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
   type="application/vnd.vmware.admin.serviceLink+xml">
   <vmext:LinkHref>{baseUri}vApp/vapp-{resourceId}/action/deleteBackup</vmext:LinkHref>
   <vmext:MimeType>application/vnd.example.vcd-backup.createBackupParams+xml</vmext:MimeType>
   <vmext:Rel>deleteBackup</vmext:Rel>
   <vmext:ResourceType>application/vnd.example.vcd-backup.vApp+xml</vmext:ResourceType>
</vmext:ServiceLink>

Response:

200 OK
Content-type: application/vnd.vmware.admin.serviceLink+xml
...
<vmext:ServiceLink ...>
   ...
</vmext:ServiceLink>