An extension service can request that vCloud Director add an event message to the event stream of an organization.
The system always creates an event message when a service posts a Task to an organization's tasks list. To create additional event messages, a service can POST an Event element to an organization's events URL.
Prerequisites
Verify that you are logged in to the vCloud API as a system administrator.
Procedure
1 | Retrieve the XML representation of the organization in which you want to create the event.
Use a request like this one:
GET https://vcloud.example.com/api/admin/org/26
|
2 | Examine the response to locate the Link element that contains the URL for adding events to the organization's events stream.
This element has a rel attribute value of event:create and a type attribute value of application/vnd.vmware.vcloud.event+xml, as the following example shows:
<Link
rel="event:create"
type="application/vnd.vmware.vcloud.event"
href="https://vcloud.example.com/api/admin/org/26/events" />
|
3 | Create an Event element that specifies the details of the task. |
4 | POST the Event element to the organization's events URL. |
Example: Add an Event to an Organization's Event Stream
Request:
POST https://vcloud.example.com/api/admin/org/26/events
Content-Type: application/vnd.vmware.admin.event+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<Event
success="true"
serviceNamespace="org.example.vcd.backup"
type="backupComplete">
<User
type="application/vnd.vmware.admin.user+xml"
name="administrator"
href="https://vcloud.example.com/api/admin/user/85" />
</Event>
Response:
204 No Content