Policy Event Stream API v1
Introduction
This document describes the format of the JSON data returned from the Policy Event Stream Service API, including the details of each field. It is assumed that the reader is familiar with developing systems that connect to streaming apis and processing JSON messages.
Overview
The Policy Event Stream API exposes raw JSON messages that are derived the Bluvision Cloud through the real time stream processing engine. This engine evaluates conditions defined in the Bluzone Portal Policy section and moves manages the "Violation State" of a given device and policy combination. Whenever the monitored conditions trigger a change in the state, one of these messages is produced. A message is generated on initial state change and a followup message is sent once when the state changes again. A guid is used to track these state changes.
Anatomy of a Packet
Messages in the Streaming API are "flattened" for easier processing.
Property Name | Value Type | Description | Always Present |
---|---|---|---|
eventUuid | String | A unique value generated on initial VIOLATION or ENTER event - corresponding CLEAR or EXIT events will have same value | Yes |
projectId | Number | The project identifier this location was generated for | Yes |
policyId | Number | The unique identifier for the policy | Yes |
blufiId | Number | The blufi device id of the Blufi that supplied the data. | Yes |
uniqueDeviceID | String | The beacon deviceId if there is a beacon involved in the policy | No |
oldState | String | The previous event state | Yes |
newState | String | The new/current event state | Yes |
value | String | The value observed for violations - implementation of this value depends on policy type | Yes |
metricType | String | The metric type of the policy | Yes |
namespace | String | The namespace of the policy | Yes |
timestamp | Number | Timestamp value with millisecond accuracy for the first packet that moved the device into violation | Yes |
timestampCleared | Number | Timestamp with millisecond accuracy for when the first packet that moved the event state to CLEARED or EXIT state. | No |
Example Packets
Note: Properties not supported by the example packet type are omitted. Fields defined above as "Always Present" should never be null, other fields may be null.
Policy Event Message
{ "eventUuid": "7c8d1944-ffe0-4812-9519-18afd0e01a3e", "projectId": "1336", "policyId": "143333122", "blufiId": "732222122", "uniqueDeviceId": "8686868686868686868", "oldState": "OK", "newState": "VIOLATING", "value": "60", "metricType": "PRESENCE", "namespace": "BEACON", "timestamp": 1456850995739, "timestampCleared": null }