Streams

Streaming At Home With The Nest API

As we are profiling APIs across different industries we are always on the look out for other interesting streaming APIs. Sure, we’d like for everyone to be using Streamdata.io, but we are in the business of understanding the world of APIs, and helping shine a light on interesting use cases–even if they aren’t always ours. One streaming API we stumbled across recently is the Nest API, out of the home automation provider Nest, who doesn’t just have a streaming API, they have one powered by Server-Sent Events (SSE)–just like Streamdata.io delivers!

The Nest streaming API is meant to support clients connecting directly to Nest services, as well as supporting cloud-to-cloud integrations, allowing for API consumers to listen for changes, instead of polling the REST API for anything new. To use the API you use the same endpoint as the regular API (developer-api.nest.com), or other more precise path, but instead of sending an application/json content type you send a text/event-stream. Once connected, you will receive updates for the Nest device as each event occurs, delivered as long running HTTP connection, aka SSE.

Streaming At Home With The Nest APIProviding a pretty compelling example of delivering Server-Sent Event (SSE) streams from events that are occuring via Nest home thermostat, smoke and CO2 alarms, indoor and outdoor security cameras. Which really illustrates a sensible use of not just streaming services, but also doing it intelligently using SSE, instead of a heavier Websockets, or other custom approach. We are regularly coming across providers using Websockets for one way streaming, which is overkill for anything that doesn’t need to send data in both directions. Making Nest’s approach something worth showcasing, even if they aren’t depending on Streamdata.io, giving a diverse range of streaming API examples to showcase, and document as part of our Streamdata.io API Gallery.

Next we will work to profile the Nest API using OpenAPI, then we’ll see if we can push the API specification to also cover the streaming edition of the API. After that,  we will play around to see if we can profile and extend the AsyncAPI specification, providing a more event-driven approach to defining what is possible with the Nest API. Crafting a machine readable definition that describes the surface area of the API, but also the topical subscription opportunities for streaming events from the devices in our homes that we are connecting to the Internet.

**Original source: streamdata.io blog