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 NameValue TypeDescriptionAlways Present
eventUuidStringA unique value generated on initial VIOLATION or ENTER event - corresponding CLEAR or EXIT events will have same valueYes
projectIdNumberThe project identifier this location was generated forYes
policyIdNumberThe unique identifier for the policyYes
blufiIdNumberThe blufi device id of the Blufi that supplied the data.Yes
uniqueDeviceIDStringThe beacon deviceId if there is a beacon involved in the policyNo
oldStateStringThe previous event stateYes
newStateStringThe new/current event stateYes
valueStringThe value observed for violations - implementation of this value depends on policy typeYes
metricType
StringThe metric type of the policyYes
namespaceStringThe namespace of the policyYes
timestampNumberTimestamp value with millisecond accuracy for the first packet that moved the device into violationYes
timestampClearedNumberTimestamp 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

Policy Event Data
{
  "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
}

Using The Service


Prerequisites