IoT Is Eating the World: APIs and REST
Guest WriterGuest Writer
Considering that 80% of devices will be IoT devices, IoT has the greatest potential to advance society since the Industrial Revolution. It will usher in a world in which all kinds of things are interconnected, smart, communicating, and improving our quality of life. But why is it that IoT still feels shallow, consumeristic, and focused mainly on “1st world” gadgets that are more of a nice to have? Just as software has transformed industries, I now believe that it’s IoT that is eating the world through data-spouting devices connected to the Internet. Here everything gets connected. We are currently in a growth spurt: the migration of analog functions monitoring and managing the physical world to digital functions involving communications and software.
With IoT, we are basically unearthing a new platform. Here’s an analogy: Before smartphones, regular phones had sensors, speakers, mics, and GPS—yet no one did anything but speak. Then, we put an operating system on top of the same core device—albiet with souped-up hardware. Now the hardware functionality is exposed as a set of APIs where devs can do what they want. Smartphones exposed a new platform, and IoT is now doing the same thing again.
An Application Program Interface (API) is a set of routines, protocols, and tools for building software applications; it specifies how software components should interact. APIs are tightly linked with IoT because they allow you to securely expose connected devices to customers, go-to-market channels, and other applications in your IT infrastructure. Because APIs connect important “things” like cars, medical devices, energy grids, and thermostats to your ecosystem, it’s critical to deploy API management that is flexible, scalable and secure.
APIs provide the ability to glue and integrate services, leaving devs to focus on application interaction vs. the applications themselves.
APIs allow developers to build context-based applications that can interact with the physical world instead of purely through UI (proximity and location-aware). To truly achieve IoT we need a REST API for every device. REST allows data to flow over internet protocols and to delegate and manage authorization.
APIs can be external services requiring a “key” for use or they can be 100% free and publicly available, not requiring registration with the originating entity. With the help of APIs, a single app can utilize software written with multiple programming languages thanks to a unified architectural style called REST. IoT means we’re building more apps, so no matter where you go in the IoT, you’re bound to need RESTful services.
Unstructured data goes to object storage, semi-structure goes to MongoDB, Cassandra, traditional and transactional data goes to SQL, MySQL and so on. As a developer, it’s challenging to deal with proprietary APIs exposed by these data sources. To integrate one unstructured, one semi-structured and one structured database in your app you have to deal with at least 3 proprietary APIs. This doesn’t make you as productive and the code is more prone to errors because you are mixing and matching highly heterogeneous API into your applications.
Imagine driving through dense city traffic using roads without any lane dividers, crosswalks, or signals. It would be utter chaos. That is the reality of the current state of IoT. There is a lack of holistic information design. We must standardize the flow of information to allow truly interoperable machine-to-machine connectivity to emerge. Thankfully, REST APIs can take us some of the way there.
When plotting connections within an IoT system, nodes are devices and arcs are APIs. Indeed, to fully realize the benefits IoT has to offer, OT assets will need to be designed with web technologies built directly into them, such as HTTP for interaction, SSL/TLS encryption, and authentication for data security, and JSON for data format. This approach is available today through a RESTful architecture.
REST (I didn’t think you had enough acronyms to remember yet) stands for Representational State Transfer and it is a concept, not a protocol. But it is the basis of the most widely used form of API today. RESTful APIs are widely used in the modern web, and data transfer usually takes place using JSON or XML over HTTP. REST is a stateless concept — e.g. that the client will connect and consume the API on demand, passing any data which is relevant to the request at time of use. It doesn't maintain a constantly open connection so it is very scalable.
Apps that are RESTful are those whose APIs follow a universal set of architectural requirements so that multiple programming languages can easily plugin to an API in a unified approach. REST is resource-based instead of action-based like SOAP.
REST APIs typically use methods of the HTTP specification to perform different actions. For example, POST, GET, PUT, DELETE can be logically mapped to SQL CREATE, SELECT (READ), UPDATE and DELETE functions. This is known as CRUD, and it means that everything you might want to do to a piece of data stored on a remote server can be done predictably through a REST API.
REST plays a crucial role, and you can use REST across the stack. REST has become a de facto protocol for the web. It's understood by almost every web server, and endpoint out there on the internet. IoT leverages a lot of REST endpoints. There are other protocols like MQTT, but the latter is still evolving. Lot’s of services rely on REST, which allows you to quickly assemble IoT infrastructure—the glue that brings multiple services together.
A certainty about IoT is, well, the Internet. The near-universal way applications and devices communicate over the Internet is via RESTful services. REST APIs provide the simplest way for connected applications and “Things” to interact in a standard, well-understood way. Plus, the data from all these connected things needs to be ingested, stored, and processed in a variety of database types. Consistent REST APIs are the most efficient way to accomplish a range of such tasks.Â
RESTÂ addresses:
Since REST uses HTTP, any device which can connect to the web and request a web page can use a REST API. REST is a good model for IoT because each device can easily make its state information available and can standardize a way to create, read, update, and delete that data. Developers can quickly build a REST model for many IoT devices. You can then, for example, easily get the state of the lightbulb (e.g. "it is off"). Then, you can send a request to turn it on. Or, you can get the current temperature from a space heater (e.g. "it is too hot"), after which you can send a lower target temperature. This model intuitively matches a whole host of problems.
The real trick in an Internet of Things product is moving data in an efficient and fast way—so at the heart of any IoT implementation rests the API(s). Done correctly, an API can speed up development. If you ultimately deliver data seamlessly to the user, you can actually enhance your user’s experience.Â
Device people and software people rarely understand each other. For the device folks, the API is the product and the app developers are the primary consumers. When building APIs for devices, you need to understand the needs of the consumers in terms of design and the preferred protocols that mimic dominant web architectures.
REST and JSON APIs generally enable software engineers to avoid reinventing the wheel when building new apps. REST is a major web architecture, and if you’re going to be building applications on the web, shouldn’t you work with the architectural trends not against it?
Making it easier for software developers to work with devices without needing to know their intricacies will make IoT more accessible to developers. REST APIs solve this challenge beautifully because they abstract the thing and expose it as an interface, enabling developers to program devices just like they work with existing backend systems when building mobile apps. To a software developer, turning on a light bulb in such a scenario looks more or less like manipulating any other software system.Â
Abundance author Peter Diamandis and Steven Kotler say that this mobile development is most important among the “rising bottom billion” for it's these individuals who can experience the greatest amount of poverty-reduction with the introduction of new technology and education through software.
In July 2015, Sam Macklin of CA Technologies and the API Academy claimed, "In the future, every successful company will be a software company and every successful software company will be an API provider."
We are in an exciting time and witnessing the growth of businesses and solutions thanks to high-quality software with robust and user-friendly APIs. Humanity is facing an app-driven future where more jobs for coders and non-coders alike will be available than people to fill them.
We're at the "hockey stick" stage of IoT adoption. Now is the best time to start formulating and developing IoT projects. There’s a lot of excitement and potential to leverage data, and there are numerous development opportunities on both the device side and software side. But there's a long way yet to go. Get some REST.Â
Written by Alex Bowen, Writer, Digital Strategist, Community Builder.
The Most Comprehensive IoT Newsletter for Enterprises
Showcasing the highest-quality content, resources, news, and insights from the world of the Internet of Things. Subscribe to remain informed and up-to-date.
New Podcast Episode
Related Articles