You can define an API for an extension service when you register the service. You can also create or update the service API definition later.

An API definition for an extension service includes an API entry point (A URL at which a client can send requests to the API) and a set of file descriptors, each of which consists of a description and a reference to a schema definition file.

An ApiDefinition element must contain the following child elements:

EntryPoint
The URL to which a client can send requests to the service API. This can be any URL, and can include the variable {baseUri}, which represents the VMware Cloud Director REST API base URL.
Namespace
The service namespace. See Register an Extension Service
Files
One or more references to schema definition files. The references must be accessible to VMware Cloud Director.

Prerequisites

This operation is restricted to system administrators.

Procedure

  1. Retrieve the XML representation of the service.
    Use a request like this one:
    GET https://vcloud.example.com/api/admin/extension/service/45
  2. Examine the response to find the Link for adding API definitions.
    This Link has the following form:
    <vcloud:Link
          rel="add"
          type="application/vnd.vmware.admin.apiDefinition+xml"
          href="https://vcloud.example.com/api/admin/extension/service/45/apidefinitions" />
  3. Construct an ApiDefinition element.
    For information about the contents of this element, see the request portion of Create an Extension Service API Definition.
  4. POST the ApiDefinition element to the URL described in Step 2.

Example: Create an Extension Service API Definition

This request defines an API for a backup service. The definition includes two FileDescriptor elements that reference files available on the vendor's public Website. The entrypoint for requests to the service is the VMware Cloud Director API login URL.

Request:
POST https://vcloud.example.com/api/admin/extension/service/45/apidefinitions
Content-type:application/vnd.vmware.admin.apiDefinition+xml
<?xml version="1.0" encoding="UTF-8"?>
<vmext:ApiDefinition
   name="Backup service version 5.1">
   <Description>Backup service API</Description>
   <vmext:EntryPoint>{baseUri}/login</vmext:EntryPoint>
   <Namespace>org.example.vcd.backup</Namespace>
   <vmext:Files>
      <vmext:FileDescriptor>
         <vmext:Description>Master schema definition file.</vmext:Description>
         <vmext:File
            href="http://example.com/backp/schema/v5.1/master.xsd" />
      </vmext:FileDescriptor>
      <vmext:FileDescriptor>
         <vmext:Description>Schema definition file for backup devices.</vmext:Description>
         <vmext:File
            href="http://example.com/vcdBackup/schema/v5.1/devices.xsd" />
      </vmext:FileDescriptor>
   </vmext:Files>
</vmext:ApiDefinition>
Response:
201 Created
Content-type:application/vnd.vmware.admin.apiDefinition+xml
...
<vmext:ApiDefinition
   name="Backup service version 5.1">
   ...
</vmext:ApiDefinition>