Registering an API extension service

Part 1: Registering the service

AMQP Message Exchange such as RabbitMQ with a Queue bound to our extensions routing key.

Defining the XML
In order to build our STaaS extension, the first thing we need to do is define the XML that registers the new API call (URL) with vCloud Director (vCD).  The service XML needs to provide the following minimum configuration parameters:

  • Exchange
  • Routing Key
  • Priority
  • API Filter
  • URL Pattern
  • Enabled

Based on the AMQP exchange that was configured in RabbitMQ, our settings are as follows

Namespace:  ExtStorageISCSI
Enabled:  true
Routing Key:  extstorageiscsi
Priority:  10
Exchange:  extstorage
URL Pattern:  /api/org/.*/extstorage/iscsi/.*

With these configuration parameters, any REST call to any vCD API URL that matches the URL pattern regular expression will be serialized and sent as HTTP requests to the extstorage AMQP exchange on the AMQP server defined in the vCD configuration.  (Note that the AMQP server is a setting that is configured in the vCD admin GUI.)

For example, a call to https://cloudserver/api/org/1d413961-a514-49ee-b62a-d782f43eab11/extstorage/iscsi/create would be intercepted by the ExtensionFilter (see introduction article) and sent to the extstorage AMQP exchange with the message sent having a routing key of extstorageiscsi.

A call to any organization ID since we have a .* for the org component of the URL, and any method under ./iscsi will be sent to the exchange, such as


The XML that defines this solution looks as follows:

<vmext:Service xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://www.vmware.com/vcloud/v1.5" name="External Storage" type="application/vnd.vmware.admin.service+xml" operationKey="extStorage">

Registering the service within vCD
In order to register the service, our XML for the service needs to be posted to vCD as an administrator user, authenticated to the System org.  Once you have logged into the vCloud API in the vCD environment, perform an HTTP POST operation of the XML to the following URL


When registering the service, you need to have an authorization token to interact with the vCloud API and have to set the Content-Type header for the extension XML POST to application/vnd.vmware.admin.service+xml.  If you wanted to register the service XML using curl, it would look like this:

Step 1: Get a login token

curl -k -c loginCookie.txt -H "Accept: application/*+xml;version=5.1" --user admin@system:mypassword https://<vCD-host>/api/login

Step 2: Register the service

curl -k -b loginCookie.txt -H "Accept: application/*+xml;version=5.1" -H "Content-Type: application/vnd.vmware.admin.service+xml" --data @serviceDefinition.xml https://<vCD-host>/api/admin/extension/service

Upon successful loading of the extension XML into vCD, the response from the POST will be an HTTP/1.1 201 Created.  If the registration fails, you will be notified as to the reason.  Now any call to this newly registered API extension will route a message to our AMQP exchange we are consuming the calls from in our business logic.  In the next article, we'll look at the message sent to the AMQP exchange, processing it, and replying to the API request.


0 # vinny 2012-11-28 00:27
is there a way to unregister/disa ble/delete/upda te the service after it is created?
Reply | Reply with quote | Quote
0 # Chris 2012-12-02 00:39
Yes, you can update/disable/ delete services after they are created. I will post an article this week on how to do so.
Reply | Reply with quote | Quote
0 # Leslie 2014-04-15 12:31
Hi there terrific blog! Does running a blog
like this require a massive amount work? I've absolutely no
expertise in programming but I was hoping to start my own blog soon.
Anyway, if you have any suggestions or tips for new blog owners
please share. I know this is off topic but I just needed to ask.
Many thanks!

My webpage http://journal-cinema.org: http://journal-cinema.org
Reply | Reply with quote | Quote
0 # Muhammad 2014-04-16 16:40
I'll immediately take hold of your rss feed as I can not in finding your e-mail subscription link or e-newsletter service.
Do you have any? Please allow me recognize in order that
I may just subscribe. Thanks.

Check out my page: http://portageparkdistrict.org: http://portageparkdistrict.org
Reply | Reply with quote | Quote

Add comment

Security code

Joomla templates by a4joomla