IoT is eating the world: APIs and REST
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, smart grids and thermostats to your ecosystem, it’s critical to deploy API management that is flexible, scalable and secure.
REST (I didn’t think you had enough acronyms to remember yet) is a developers best friend.
We are in an exciting time and witnessing growth of businesses and solutions thanks to high-quality software with 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. Abundance author Peter Diamandis and Steven Kotler say that this mobile development is most important among the “rising bottom billion” and it is these individuals who can experience the greatest amount of poverty-reduction with the introduction of new technology and education through software.
“For the first time ever,” Diamandis says, “the rising billion will have the remarkable power to identify, solve and implement their own abundance solutions.”
In July 2015, Sam Macklin of CA Technologies and the API Academy notes:
“In the future, every successful company will be a software company and every successful software company will be an API provider.”
IoT has a lot of potential for addressing and solving many serious problems. But why is it that IoT feels shallow, consumeristic and only focused on “1st world” gadgets that are more of a nice to have?
In this series, I will also be exploring Open Source solutions for IoT Development. One of these I would like to highlight is DreamFactory Software.
- An API Platform that allows you to build IoT Applications
- Open Source
- Automatically generates REST APIs
- Low code platform, with custom scripting support
- Automatically creates Documentation, through Swagger, for your APIs
- Maximizes the reliability, scalability, and security
As an open source RESTful backend integration platform, DreamFactory is poised to play a significant role in the IoT. It not only provides secure REST APIs for any data source, it keeps true to the open source nature of many key foundational technologies on which the Internet is built.
Making it easier for software developers to work with connected things without needing to know the its intricacies or protocol will make the IoT more accessible to developers. 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 now looks exactly like adding data to an SAP system. The API Layer is leveraged by IoT architecture to connect to the server layer. This provides consistency, control, governance, security and an analytics-based model for connecting external sites.
REST (Representational State Transfer) 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 does not maintain a constantly open connection so it is very scalable.
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.
As it 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 on a way to create, read, update, and delete that data. Developers can quickly build (or leverage from DreamFactory) a REST model for many IoT devices. You can then, for example, easily get the state of the lightbulb: it is off. Then, send a request to turn it on. Get the current temperature from the space heater: it is too hot. Send a lower target temperature. This model intuitively matches the problem space.
With the help of APIs, a single app can utilize software written with multiple programming languages thanks to a unified architectural style called REST.
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 recourse based, instead of action based like SOAP.
- Simplicity of interfaces
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.
Why APIs matter to IoT
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.
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 the IoT. There is a lack of holistic information design. We must standardize the flow of information to allow true machine-to-machine connectivity to arise, and thankfully, this can be achieved using APIs — REST APIs to be specific. Populating urban environments with innovative machine-to-machine connections is the future of the IoT.
When plotting connections within the IoT, 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. An API is a set of routines, protocols, and tools for building software applications; it specifies how software components should interact.
How exactly are we going to use REST?
REST plays a crucial rule, and you can use REST accross the stack. REST has become a de facto protocol for the web and is understood by almost every web server, endpoint and server that is out there on the internet. IoT leverages a lot of rest end points, of course there are other protocols like MQTT, but it’s not very mature and is still evolving. Lot’s of services rely on REST, and it allows you to quickly wire up IoT as glue that bringing multiple services together.
I want to introduce how DreamFactory can be applied in various scenarios. 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 code is more prone to errors— because you are mixing and matching highly heterogeneous API into your applications.
This is a problem that DreamFactory solves.
DreamFactory is a single unified facade that exposes consistent REST API for over a dozen data sources. So, it doesn’t matter what kind of data source you deal with, you will use a consistent, uniform set of REST endpoints. Standardize your code on REST and you can use the same API to talk to mongodb, or cloud storage — you can use the exact same REST interface to talk to any relational database. You can also create users that are tied to role based access control.
DreamFactory’s REST APIs provide a unified, universal data access layer to deal with all things data, and it doesn’t matter what kind of database you are dealing with.
This is the engine that extracts the complexity of the underlying database APIs by exposing simple, unified rest API. This engine is perfect for IoT app development and can be used as a universal data access layer. If you are using a database that DreamFactory doesn’t support, you can register your third party API with DreamFactory so you can integrate any third party API or database.