How APIs Support IoT on the Edge

Today’s experience economy puts consumers in the driver’s seat now more than ever before, and organizations must move quickly to meet their rising expectations. New technologies like the Internet of Things (IoT) deliver invaluable, relevant data, but transforming that data into actual user functionality is the real key to happy customers, and that’s the job of APIs.

IoT devices and their sensors that capture and store valuable data can tell you a lot about your customer. When done right, the information they surface can mean the difference between making the right offer at the right time and one that falls short of customer expectations. Edge computing takes this principle one step further with quick data processing and decision-making closer to the device. However, the challenge with this scenario is discovering how best to communicate data from IoT devices into actionable processes.

Enter the API. As a connector between applications and IoT data, APIs enable data flow between devices and the cloud, from the cloud to your backend systems and from users back to their devices. For example, if you turn on your IoT-enabled smart lights via an app, it calls an API that turns on the light. This also applies to interactions like setting timers and triggering firmware upgrades, which are usually done via API calls from users back to their smart devices. APIs are increasingly used by DevOps teams because, by their very nature, they can be a great Resource to help develop, test, and deploy data solutions. They also help accelerate business innovation.

As valuable data is collected by IoT devices, pre-computing of that data is done at the edge, meaning on the devices themselves. This is a common occurrence in industries like aviation, because you can’t transport all sensor data that is created during a flight. Instead, only alerts and summarized metrics are transmitted to lower data volume during flights. While this allows for faster, more efficient processing, the pre-computing that is done there can be problematic for traditional DevOps teams who are used to controlling the process within an organization from start to finish. To solve this problem, DevOps would likely look for a script to run, but of course, a successful script will largely depend upon the architecture and many other factors.

Today’s APIs are the important enabler DevOps relies on to transport and transform raw data, regardless of where it comes from, into a satisfying User Experience. But in a constantly changing, customer-centric ecosystem, change is often the only constant. This is especially true with IoT applications. Here are three tips for using high-performing APIs at the edge:

First, you need to Implement stringent testing processes. To ensure the tools you use are capable of managing the sprawl of IoT devices sufficiently, testing is critical. APIs are a great testing tool and will help you manage and even scale this complex relationship by building different layers. I recommend beginning testing in house in labs to verify changes and to check for any breaks. Automating your tests to learn from previous issues revealed during testing and improving upon them is the best practice. You should also test and verify rollbacks, and be sure to perform a rollout to a smaller group of devices and measure its impact, errors, and returns. If success rates meet expectations, you can then open the door for mass deployment.

Second, from nanny-cams to controls for the national electric grid, IoT devices are notorious for their weak security, which is why, when you’re outfitting your devices with IoT APIs, you must design those APIs with security at the forefront. Securing data in motion is anything but straightforward. In addition, the early stage technology used in IoT and edge computing means your team will face a learning curve with regards to keeping things secure from prying eyes. Be sure to hone your security knowhow (or find an expert) and think of the big picture. Here’s a quick checklist of security aspects to consider first and foremost when building APIs:

  • API throttling and API/user quotas
  • Authentication best practices
  • Setting up logging and metering
  • Content and message validation as well as additional checks that ensure against Payload tampering or interception

Third, use controlled rollouts and define rollback procedures. While speed is a valuable attribute of DevOps’ release cycles, new technology can and will have challenges. You will encounter bumps along the way, so consider building in controlled rollouts of any update by using gates, and sequentially introduce the rollout to a small percentages of users to ensure success before expanding to a wider group. Controlled rollouts means rolling out production APIs via a defined and gradual procedure that are based on gates (see above on testing). Gates are the specific benchmarks that help to qualify whether or not you can execute the next stage in the rollout; for example, a production API is only allowed to leave inhouse labs as part of a controlled rollout when 99% of devices upgrade without issues or needing to reboot.

In this case, a DevOps team can set up multiple gates with varying confidence levels to define the entirety of their controlled rollout technique. A team may start out with an initial gate of about 100 devices to test, and once this group of devices passes a 99% confidence level (meaning 99% of the devices exceed the metrics being tested), a team can move to the next gate. This gate might include 1000 devices and a 99.9% confidence level. API error rates or unusually lengthy end-to-end processing times are examples of the metrics the team can monitor to define the gate as part of the controlled rollout.
Be sure to articulate your rollback procedures and implement kill switches. Lastly, make sure the entire process is transparent, so the entire DevOps team can learn from the process, and in the event of a problem, ensure it doesn’t happen again.

To deliver relevant, timely solutions that redefine customer experiences and foster lasting relationships, you have an unlimited number of opportunities considering the sort of data that you gather via IoT, computed at the edge, and then masterfully connected with users via APIs.

Be sure to read the next Internet of Things article: Android Things Dev Preview 7 Intros New Bluetooth APIs