When you register an extension service with vCloud Director, you specify one or more API filters, which are URL patterns or MIME content types that the vCloud Director REST service should treat as extension requests. You cannot update the API filter for a registered service, but you can replace it with a new one.

An API filter can be either a URL pattern, typically in the form of a regular expression, or a content type, typically in the form of a MIME content-type string. Requests whose URL matches the specified UrlPattern are sent to the service that has registered the filter. An API filter that specifies ResponseContentType is applied only to responses whose Content-type attribute has a value that matches the specified ResponseContentType. An extension service that receives such a response must return it, after making any service-specific modifications, to the AMQP service as a JSON message, so that it can be returned to the vCloud Director client that made the request.

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 API filters

This Link has the following form:

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

Construct an ApiFilter element.

This ApiFilter overwrites any existing ApiFilter defined by the service. See the request portion of Example: Create an API Filter for an Extension Service for information about the contents of this element.

4

POST the ApiFilter element to the URL described in Step 2.

This request adds a new UrlPattern to set of patterns defined in the request portion of Example: Register an Extension Service. The request replaces the existing set of filter expressions with a new one that includes the original set and one additional expression.

Request:

POST https://vcloud.example.com/api/admin/extension/service/45/apifilters
Content-type:application/vnd.vmware.admin.apiFilter+xml
<?xml version="1.0" encoding="UTF-8"?>
<vmext:ApiFilter>
   <vmext:UrlPattern>(/api/org/.*/backups)|(/api/vApp/vapp-.*/backups)|(/api/vApp/vapp-.*/action/backup)|(/api/backup/.*) | (/api/vApp/vapp-.*/action/recoverBackup)</vmext:UrlPattern>
</vmext:ApiFilter>

Response:

201 Created
Content-Type: application/vnd.vmware.admin.resourceClass+xml
...
<vmext:ApiFilter>
   <vmext:UrlPattern>(/api/org/.*/backups)|(/api/vApp/vapp-.*/backups)|(/api/vApp/vapp-.*/action/backup)|(/api/backup/.*) | (/api/vApp/vapp-.*/action/recoverBackup)</vmext:UrlPattern>
</vmext:ApiFilter>