APIs for the Internet of Things: ThingSpeak, Pachube and Fitbit
APIs have become the lifeblood of software. In the big business of the Internet of Things, application programming interfaces play an essential role in the collection, analysis, visualization and manipulation of data. Here are three good examples.
When Marc Andreessen, one of the great gurus of venture capital investments in startups, wrote ‘Why Software is Eating The World’ in The Wall Street Journal back in August 2011, he probably already had in mind what APIs (application programming interfaces) would represent for developing software and new business models. It can be said that APIs are eating the world and an example is their influence on the Internet of Things (IoT).
These APIs enable developers to connect to the world of objects and interrelate the devices surrounding us: 'plugging in' our body to monitors of vital signs, automating our home, almost turning our vehicle into a living being… APIs have become the lifeblood of software and the so-called Internet of Things wouldn't exist without them. APIs incorporate and work with data that facilitate the connection between objects.
Today most solutions of the Internet of Things revolve around four basic pillars which are mobility, social economy, analysis of large volumes of data and cloud-based computing. According to a Cisco study, the estimated global market around IoT will rise to $14.4 trillion in 2022, a figure that has grown steadily in recent years. Therefore, there is business for developers and APIs are one of the main keys.
We will try to analyze three APIs of the Internet of Things here from a huge list of interfaces that are already operating in this expanding market:
The ThingSpeak API always works with data; that is its specialty. This open API for the Internet of Things allows you to collect, store, analyze, visualize and act on the information collected in sensors and devices such as mobile and web applications, social networks like Twitter, messaging solutions, VoIP and cloud-based solutions such as Twilio, open source hardware such as Arduino, Raspberry Pi and BeagleBone (the kings of the Internet of Things and robotics) or computer calculation languages like MATLAB... ThingSpeak is an API known among developers and already has a large community.
ThingSpeak API always works with channels, which contain data, location and status fields. To start working with this interface a channel needs to be created, where the information on devices and applications will be collected, data that can subsequently be analyzed and visualized in graphics (this is a fairly comprehensive tutorial on how to create graphics with ThingSpeak) and the final step is to operate on these documents. The process with the API is always the same.
In the end, the project path with the API will look similar to the following, replacing the fields CHANNEL_ID and FIELD_ID with the data from the newly-opened channel.
An example of the type of graphics that be can be created as a result of the collection, analysis and visualization with ThingSpeak are these temperature measurements:
2. Pachube API (Xively)
Pachube's API allows you to store, share and analyze real-time energy or environmental data collected by sensors in buildings and other devices. All the functionality of Pachube's system is provided by the API, which aids the information generated by buildings, energy meters or mobile devices with sensors being collected and analyzed and all these objects connected to each other. It is the true Internet of Things.
Pachube's API functions in EEML (Extended Markup Language Environments), a protocol for exchanging data from sensors in remote environments, whether physical or also virtual (a typical example is the connection with Second Life objects). The fact that there is a universal protocol is what enables people to share with the community millions of pieces of real-time data from objects, devices or spaces around the world.
The steps to start working with Pachube are quite simple:
● Add a device: developers give a name, description, and privacy permissions to the device they want to add and an ID is automatically assigned as well as the API key required to connect the terminal.
● Test run: once added and connected, developers can begin to see data values updated in real time on their channel and debug irregular changes seen in that information.
Fitbit's API aids developers with the work of interacting with the data collected by any of the Fitbit products whether it be an application, a device or service. Today, Fitbit's API supports most languages for reading and writing information, but they offer a community for developers where it is possible to make suggestions and evolve the API.
What Fitbit's API ultimately allows is for anyone to be able to develop an app to access and manipulate data collected for a Fitbit device, provided it meets two obvious requirements: this must be data related to the actual user and no other person and meet the conditions of use established by the documentation of the actual API.
How can you start to try and work with Fitbit's API?
● Registering the app: registering the app makes it possible to obtain the customer's credentials from the API. To do this you must first have an account in the Fitbit service (it is completely free of charge to open).
● Access to user data is done through OAuth authentication. Requests to Fitbit's API to read and write user data are made through this browser of the API. You may also subscribe to the API to update the data in real time (it is done like this).
● Developers must choose a OAuth 2.0 library that operates with the programming language and development framework used for the data stream. Without this library, the authorization protocol cannot be created.
API requests require the credentials of an authorized user.
If you are interested in the world of APIs, find out more about BBVA's APIs here.
Follow us on @BBVAAPIMarket
Sign up to the BBVAOPEN4U newsletter and receive tips, tools and the most innovative events directly in your inbox.