When you register an extension service with VMware Cloud Director, you specify one or more API filters, which are URL patterns or MIME content types that the VMware Cloud 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 VMware Cloud Director client that made the request.
Prerequisites
This operation is restricted to system administrators.
Procedure
Example: Create an API Filter for an Extension Service
This request adds a new UrlPattern to set of patterns defined in the request portion of 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.
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>
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>