Johnson Controls time series API
This section describes the operations you can perform on time series sample data. ### Origin of Time Series data The Metasys system has two locations from which time series samples can be retrieved. The first is from the _trend_ or _log_ object, itself. Each object on the Metasys site whose responsibility is to generate samples will have its own _buffer_ to store them. When samples are retrieved from the `objects` endpoints, they will be retrieved from their respective buffers. Time series operations that work with a buffer will include "(buffer)" in their summary. The second location is from the _repository_. As samples are collected in the _trend_ or _log_ objects themselves, those objects (if configured and enabled) have the ability to forward that information to a _repository_. The _repository_ is the location on the LAN (Local Area Network) that can receive and store historical data from one to many Metasys sources. Samples retrieved from the `timeSeries` endpoint are retrieved from the particular Metasys device's repository. Time series operations that work with the repository will include "(repository)" in their summary. ## Subscription Streaming Events Clients may subscribe to Objects and Network Devices streaming events. A subscription is established by providing a `METASYS-SUBSCRIBE` header on a `GET` operation of the `samples` resource under either the `objects` resource paths. ### Events The following events (with accompanying examples) are available for samples: - `timeSeries.subscription.established` - Indicates when a subscription has been established for `objects` samples. - `timeSeries.subscription.cancelled` - Indicates when a subscription has been cancelled for `objects` samples. - `timeSeries.error` - Indicates an error occurred with regards to an active samples subscription. - `timeSeries.samples.update` - Indicates new samples have been generated. Sample updates from multiple objects and attributes can be contained in a single event (each designated by their `sampledByObjectId`, `sampledObjectId` and `attribute` properties). - `timeSeries.heartbeat` - Indicates that time series subscription(s) are still alive. ## Metasys-Call-Async Streaming Events Clients may subscribe to Objects Samples Response streaming events. A subscription is established by providing a `METASYS-CALL-ASYNC` header on a `GET` operation of the `samples` resource under either the `objects` resource paths or `POST` operation of the `samples` resource under batch operation of times buffer. The following events (with accompanying examples) are available for samples: ### Samples Events The following events (with accompanying examples) are available for async samples: - `timeSeries.samples.stream.started` - Indicates when a subscription has been established for `objects` samples response. - `timeSeries.samples.stream.error` - Indicates an error occurred with regards to an active samples response subscription. - `timeSeries.samples.stream.data` - Indicates samples responses for each request. Samples from multiple objects and attributes can be contained in a single event (each designated by their `sampledByObjectId`, `sampledObjectId` and `attribute` properties). - `timeSeries.samples.stream.completed` - Indicates that a streaming samples response has completed successfully.