When an aggregation fires, if the 'Triggers Events' setting is enabled, an extra step happens beyond just writing a row of aggregation data. An 'Event' is created within your Prophecy site, which contains basic information about the aggregation data row that was just written. These events can be accessed through a REST API, so that external services can find out about aggregation rows when needed. An integration like this will have to be built by a developer, and will require information and access that will not generally be directly available. Contact the Prophecy Consulting Group for assistance with getting those custom integrations built.

The pieces of information available on an event object retrieved through the API are:

  • AggregationEventId: The internal Prophecy Id for this event. Used for PUT and DELETE actions (see below).
  • RuleId: The Prophecy Id for the aggregation rule.
  • EventDateTime: The date & time (adjusted for the server time where Prophecy is running) that the aggregation fired.
  • Active: Boolean - true by default. When the GET endpoint is hit (see below) all active events are returned. To disable an event once it has been processed by your external system, use the PUT endpoint (see below) to set it to disabled.
  • ResultTableName: The name of the aggregation table where the aggregation data record was written.
  • ResultTableRecordId: The Id of the aggregation data record in the table named above.

The events API endpoint is at at https://www.yourprophecyURL.com/api/events and supports these actions:

  • GET https://www.yourprophecyURL.com/api/events: Returns a JSON document containing a list of all active aggregations for this Prophecy IoT site. Depending on when this was done last and the number and types of aggregations configured, that can be a very large list.

  • GET https://www.yourprophecyURL.com/api/events/{aggregationEventId}: Returns a JSON document with the details of the requested event.

  • PUT https://www.yourprophecyURL.com/api/events/{aggregationEventId}: The body of the request should contain a JSON document with the details of the event being updated. Note that the 'Active' property is the only property allowed to be modified through this endpoint.

  • DELETE https://www.yourprophecyURL.com/api/events/{aggregationEventId}: Deletes the specified event competely. Note that the associated aggregation data row will not be removed, just the event record.