Standardizing APIs Across the IoT
The Internet of Things (IoT) typically involves sensors that monitor and track all sorts of data, cloud-based apps or services that translate them into useful intelligence, and communication mechanisms that enable mobile and real-time responses. I find it totally fascinating. Look at what becomes possible and easier with IoT: smart home, smart car, smart bridge, smart oil wells, and even smart cities. There are plenty of use cases for IoT, which is why it is delivering on its promise to be “the next big thing.”
An IoT-based system often involves integrating multiple sensors and cloud-based services (via APIs). While these cloud-based APIs greatly reduce the time and effort needed to build the system, it can also be a headache for developers as each API comes with specific choices about protocols, format, authentication, etc. So when I discovered a cloud service that provides a common programming platform that standardizes access to APIs, I had to try it out.
Temboo can be a cure for the API headache. Actually, xMatters already provides a cloud service that makes its integration easy. But easy access from Temboo will make it potentially even easier to use these xMatters services. Temboo is also particularly useful with IoT since it enables embedded devices (like Arduino, Beagebone and Raspberry Pi) to interact with the cloud services.
Taking Action
I had the opportunity to see this in action as a 555 project. My goal was to integrate the xMatters Communication API (CAPI) so it can be used with Temboo. To make it a bit more interesting, I set the following use case to implement:
Given an address, use Yahoo weather service to obtain the current temperature for that address, then use xMatters CAPI to send a notification (email or SMS).
The Temboo platform features widgets called choreos, which can be combined or chained into complex, multi-step integration workflows. The Temboo library maintains more than 2,000 choreos, including the Yahoo weather service.
Temboo also provides facilities to create your own choreos:
- to integrate services that are not yet published in the Temboo library
- to chain together multiple services into a single Choreo for greater efficiency
Implementing the Use Case
You author choreos using a graphical interface, using the Temboo IDE called Twyla and combining a set of steps. Each step maps to a task such as evaluating an expression, sending an email, sending an HTTP request, or launching another choreo. I created a custom choreo, called “xMatters_send_notification,” that sends an email notification using the xMatters Communication API’s notification service.
With the xMatters CAPI custom choreo available now, we are ready to implement the above use case. The use case is implemented by chaining together the Yahoo weather service (getTemperature) and the xMatters_send_notification choreos as shown below:
The above choreo takes an address, retrieves the current temperature for that address, then sends an xMatters notification with the temperature information. The snapshots below shows a successful execution of the above Choreo:
In the CAPI webUI, a notification has been triggered as a result, which has been configured to send an email (to me in this case):
Email sent by the xMatters notification:
Summary
From the experiment done, I can see that Temboo does make it easy to integrate and use cloud services by encapsulating the vendor specific details and instead providing a common interface (Temboo IDE). While the experiment only involved a single cloud service (Yahoo Weather Service), more realistic use cases would involve utilizing multiple services. Without Temboo I would need to understand how to use the API of each service.
Creating custom choreos for xMatters CAPI was also straightforward, reflecting the standard interface (REST API) used by xMatters. Other choreos can be easily created for other xMatters APIs.