In Today’s connected world Internet of thins (IoT) is no longer a buzz word that’s thrown around by experts. It is Real!! And can be found all around us, changing lives, facilitating better services, improving processes, providing new opportunities and increasing revenues.
With billions of new devices that are yet to be connected to the internet, the impact of IoT will definitely be driven beyond the IoT devices themselves to several other applications by leveraging the data provided by these devices to achieve social and commercial growths. This is already happening as most organizations today that don’t have IoT solutions deployed, are still able to reap the benefits of it by getting access to the data generated by devices deployed by other people by using their APIs.
What is an API and how is it useful?
The acronym API stands for Application Programming Interface, these are not a new and limited to IoT, they have been used in software development for a long time. APIs facilitate the easy integration of different services into products, allowing applications written in one language to be used by software written in another language, helping in reduction of overall infrastructure and time requirement for product development. These same advantages are currently being transferred into IoT applications with APIs being used across diverse application to expose data that enables multiple devices to be combined and connected to solve new and interesting workflows, revealing unseen possibilities around IoT.
When signing up for new services (say Spotify), we would have commonly come across options like “Sign in using Gmail” or “Sign in using Facebook”. These are nothing but APIs provided by Google/Facebook to Spotify to make the signing up procedure easy. Here the API will share basic user details like Name, E-mail ID, Phone number etc with Spotify and help you in saving time with signing up procedure. Likewise different APIs are available for different application needs.
1. OpenHAB REST API
Open Home Automation Bus (openHAB) is an open source, technology agnostic home automation platform which helps to connect and control smart devices and “not-so-smart” home devices in one place. It allows the performance of user-defined actions by devices, using user-defined information and user-defined tools. To achieve this, openHAB segments and compartmentalizes certain functions and operations all of which could be accessed through the openHAB REST API.
Through the openHAB REST API, users can access to the data of all devices associated with the platform, the devices themselves (things) and Bindings, as well issue commands and actions to change the state, behaviour, or properties of the devices connected to openHAB. Interaction with the API is based on the HTTP protocol; as such it is important to ensure secure and safe connections when working with it. According to the openHAB website, some of the interactions possible via the openHAB REST API include;
- Retrieve openHAB data from external applications
- Inject data and trigger events in openHAB from external applications (for example, some motion detectors or surveillance cameras)
- Inspect openHAB Bindings/Things or Items, learn about current states, parameters or problems
- Interacting with openHAB from other programs; many programming languages and automation tools can easily make use of REST API
- Using third party software on cell phones, such as Tasker to open your garage door
Documentation, more examples and detailed instruction on the use of the API can be found on the OpenHAB’s website.
Third party apps like Tasker being used with openHAB is a big pointer to how APIs are opening up the IoT economics, providing opportunities for additional value creation along the chain.
2. Mozilla Web Things API
Mozilla is a non-profit with the mission to defend the free and open web and the web things API represents its efforts to extend its participation on the web to IoT. According to the Web Things website, the Web Things API allows users to provide unique URLs to all connected devices on the World Wide Web, allowing it to be used as a unifying application layer for all the IoT devices.
The Web Things API, like most other IoT APIs, is based on REST and allows users to; access the properties of devices, determine current state of each device, and issue commands to change the state of the device or perform actions. The WebThings API makes accessing resources, representing each aspect of a device easy, as each resource is independently referenced using a URL. More information can be found in the Mozilla IoT website.
OpenWeatherMap is a web based service that provides access to weather related data (temperature, humidity, rainfall, etc), including current weather, forecasts and historical data to the developers of web services, mobile and more recently IoT applications. The data available via OpenWeatherMap are sourced from sources ranging from DIY weather stations to meteorological broadcast services, airport weather stations, and several other sources. We have already discussed how to use Openweather Map with Arduino to read weather data from internet using ESP8266.
The data is processed and sorted in such a way that via the OpenWeatherMap API, IoT solutions which leverage these data to inform and automate tasks can be built. For instance, forecast data via the API can be fed into an alarm system/device to warn farmers of possible heavy downpour among several other possibilities.
While the most of the features of OpenWeatherMap are paid, the free package has immensely useful features which can serve most IoT projects pretty well. Documentation and other details about the API can be found on the openWeatherMap website.
4. EmonCMS API
EmonCMS is a powerful open-source web-app for processing, logging and visualizing data. It is a product of the efforts of the OpenEnergyMonitor group to, just like the name implies, facilitate open source energy monitoring devices by analyzing Environmental data. It is essentially a data visualization tool where data from several energy monitoring sensors can be viewed. To make it easy for developers to access the platform, a connectivity API was created to allow interaction with the platform when running on localhost (LAN) or via the internet. The EmonCMS API allows users update the status of energy devices on the platform, obtain readings and other parameters indicating the state of devices (if the device is compatible) from the platform along with several other features.
Looking to add some data visualization to your next energy based IoT solution? The EmonCMS may just be what you need. More information on the platform and the API can be found on their website.
5. Particle API
Particle API is the Application programming interface developed by Particle to allow developers easily work with their platform. Particle.IO is one of the industry’s true end-to-end IoT solutions providers, providing the device hardware, Cellular communication, device cloud and application interfaces. We have previously used Particle Cloud with Raspberry Pi for Home Automation purposes.
The Particle API makes it easy for developers to access and integrate the full functionality of Particle with other applications and devices. According to particle, the API allows developers to write functions to their device's firmware and then call them for use in on the application side of things in real-time. Some example API methods include turning the wifi off and on, connecting devices, toggling the state of the devices, obtaining data and generally managing the devices.
Documentation and other details about the API can be found on ParticleIO’s website.
6. Adafruit IO API
Adafruit is one of the most popular brands in the DIY electronics world and their decision to launch the Adafruit IO platform for IoT solutions a while back was well received by the maker/electronics hobbyist community. The platform has kept on growing since then and has served a good number of makers including me. The Adafruit IO platform is essentially a device cloud with data visualization features amongst others all driven by the Adafruit IO API. We have already used Adafruit IO with PIC and other development platforms like ESP and Raspberry Pi as well.
According to Adafruit, The Adafruit IO HTTP API provides users with access to their Adafruit IO data from any programming language or hardware environment that can speak HTTP. Through this they can design systems that take action based on the data, and effect changes in the device by sending information to the devices.
The Adafruit IO platform is one of the easiest platforms to work with and it’s one of my favorites for DIY IoT projects. Documentation and more details can be found on Adafruit IO’s website.
7. Home Assistant API
Home Assistant is a community led, open source home automation system similar to openHAB. Like other platforms, Home Assistant is driven by the Home Assistant Python REST API which provides access to data methods for the Home Assistant control service.
It enables users to edit configuration, return basic information about the Home Assistant instance, return all data needed to bootstrap, return an array of event objects and more. The API accepts and returns only JSON encoded objects that contains event name, listener count and more. It is based on python 3 and helps to effortlessly track and control all registered home devices, irrespective of whether the registration was done via web or the mobile app. Documentation and more details on the API can be found on Home Assistant’s website.
8. The Things Network APIs
LoRa is becoming one of the communication channel of choice due to it’s long range, low power consumption amongst other features. The Things Network (TTN) is an open source, community driven effort to build a global open LoRaWAN network to create open infrastructure to facilitate the development of LoRa based IoT solutions. As such, TTN provides a set of open tools and a global, open network featuring maximum security and scalability. If you are new to Lora then go through detailed article on Introduction to LoRa and LoRaWAN.
Interaction with the TTN platform is driven by two major APIs; the TTN Data API and the TTN Application Manager API. The Data API allow you to receive events and messages from devices as well as send messages to devices, generally, exchange information with devices. The Application Manager API, on the other hand, is used to manage applications, gateways and devices. The Data API is based on the MQTT protocol and can be used for development via the SDK or directly with MQTT while the Application Manager API is based on the HTTP protocol. More information on these API can be found on The Things Network’s website.
9. ThingSpeak.io REST API
ThingSpeak is regarded as one of the topmost open source, cloud platform for IoT devices. It’s one of the best platforms for processing data from devices especially due to its integration with MATLAB after being acquired by Mathworks some years back. It allows users to upload, aggregate, analyze and visualize data using MATLAB without the need to acquire the MATLAB software separately. All of the above is facilitate using the ThingSpeak API. Just like most of the other APIs mentioned above, the ThingSpeak API allows users; collect and stores sensor data, retrieve data and current state of connected devices, automate events based on data, setup triggers based on state of IoT devices, and integrate with social media platforms like twitter amongst other features. To learn more about ThingSpeak, check out previous IoT projects where ThingSpeak has been used with many different microcontrollers like Arduino, Raspberry PI, ESP etc:
- Live Temperature and Humidity Monitoring over Internet using Arduino and ThingSpeak
- Heart Beat Monitoring over Internet using Arduino and ThingSpeak
- Raspberry Pi Weather Station: Monitoring Humidity, Temperature and Pressure over Internet
- IoT Based Patient Monitoring System using ESP8266 and Arduino
Some of the features of ThingSpeak which automatically translate to benefits of using it’s API are;
- Easy device configuration to transmit data to the ThingSpeak platform using standard IoT platforms.
- Real-time visualization of sensor data and data aggregation using third party sources.
- IoT analytics runs based on schedules or events.
- MATLAB analytics, RESTful and MQTT APIs.
- Enables the prototyping and building of IoT systems without any server setup and Web software installation.
- Compatibility with popular development platforms like the Arduino and Raspberry Pi
- Automatically acts on data and automate tasks
- Integration with third party services like Twitter. A good example of a situation where this is a useful is an IoT solution that automatically tweets water level.
In addition to the free hosted API, the ThingSpeak API is open source and available on GitHub for download on private servers.
10. EdgeX Foundry
EdgeX Foundry is an open source ecosystem of IoT platforms based on open source configurations. The EdgeX Foundry API offers several endpoints for services including client registration, scheduling, and logging. The API has a REST architecture and uses OAuth 2.0 for authentication. Edgex has a series of micro service which are attached to each device connected to the network.
Each micro service has several important API calls that can be used to;
- Register a device service
- Provision a Device
- Send data from device to the Edgex platform,
- Reading the data from the Edgex platform for use in other applications
- Exporting data, amongst others.
Documentation and more details on the API can be found on EdgeX Foundry website.
That’s my list! This list is however in no way exhaustive as some other APIs like IoT-Plotter and others that I could have added to the list are coming to mind. Feel free to drop comments about the Open IoT APIs that you have worked with. Your comments may go a long way in helping others select an API or platform to use in their projects.
Till Next time.