Table of Contents

  1. Overview
  2. Categories of API
  3. Difference between an API and a Library
  4. Walk through an example
  5. 5 APIs every Data Scientists should know
  6. List of 5 cool data science projects using APIs
  7. Welcome to the new playground

 

1. Overview

APIs are widely used by developers for implementing various features in their software. They simply use a simple API call within their software to implement complex features instead of having to code it by themselves.

Let’s try and understand it better with the help of an example:

Pokemon Go has been one of the most popular smartphone games. But in order to build such a game taking in account the large ecosystem, one requires complete information of routes and roads across the globe. I’m sure the developers of the Pokemon Go must have faced a dilemma if they should code the maps of the entire world or use the  existing Google maps to build their application on top of it. They choose the latter, simply because it’s practically  not possible to create something similar to Google maps in a short span of time.

screen-shot-2016-11-18-at-10-20-04-am

This is just one example. There are a lot of developers using various APIs to implement complex features into their applications instead of coding it themselves. Therefore, API provides a very convenient way of making code reusable.

 

Basic elements of an API:

An API has three primary elements:

 

2. Categories of API

A web API is an interface to either a web server or a web browser. These APIs are used extensively for the development of web applications. These APIs work at either the server end or the client end. Companies like Google, Amazon, eBay all provide web-based API.

Some popular examples of web based API are Twitter REST API, Facebook Graph API, Amazon S3 REST API, etc.

There are multiple OS based API that offers the functionality of various OS features that can be incorporated in creating windows or mac applications.

Some of the examples of OS based API are Cocoa, Carbon, WinAPI, etc.

Interaction with most of the database is done using the API calls to the database. These APIs are defined in a manner to pass out the requested data in a predefined format that is understandable by the requesting client.

This makes the process of interaction with databases generalised and thereby enhancing the compatibility of applications with the  various database. They are very robust and provide a structured interface to database.

Some popular examples are Drupal 7 Database API, Drupal 8 Database API, Django API.

These APIs allows access to the various hardware components of a system. They are extremely crucial for establishing communication to the hardware. Due to which it makes possible for a range of functions from the collection of sensor data to even display on your screens.

For example, the Google PowerMeter API will allow device manufacturers to build home energy monitoring devices that work with Google PowerMeter.

Some other examples of Hardware APIs are: QUANT Electronic, WareNet CheckWare,OpenVX Hardware Acceleration, CubeSensore, etc.

 

3. Difference between an API and a Library

At this point, I believe you might be scratching your head and confusing APIs with libraries. Let me simplify it for you, an application programming interface (API) is an interface that defines the way by which an application program may request service from the  libraries.

An API is a set of rules with which the interaction between various entities is defined. We are specifically talking about interaction between two software.

Even a library also has an API which denotes the area of the library which is actually accessible to the user from outside.

 

4. Walk through an example

IBM Watson has made certain data science APIs public for people like us to build amazing projects with only a few lines of code. Here, we’ll be looking at one such amazing API offered by IBM called Personality Insights.

This API takes as input in JSON, HTML or simple text format. The input contains text related to the person whose personality interests you. It can be anything like tweets, daily experiences, applications, opinion, etc of that person.

The output generated by the API is in the standard format of JSON or CSV file that contains the information on various social traits of that person. And the developer only needs to display this generated file to the user instead of coding the whole functionality yourself.

There is also a demo on the IBM website that can be accessed here. You can choose either the tweets or replies of few famous personalities to analyze their personality traits. The text can also be customized based on what input you want to provide and analyze the personality traits of that person.

You can integrate this API in your code as well and build an application on top of this API.

 

5. 5 APIs every Data Scientists should know

Facebook API provides an interface to a large amount of data generated everyday. The innumerable post, comments and shares in various groups & pages produces massive data. And this massive public data provides a large number of opportunities for analyzing the crowd.

It is also incredibly convenient to use Facebook Graph API with both R and python to extract data. To read more about the Facebook API, click here.

Google Map API is one of the commonly used API. Its applications vary from integration in a cab service application to the popular Pokemon Go.

You can retrieve all the information like location coordinates, distances between locations, routes etc. The fun part is that you can also use this API for creating the distance feature in your datasets as well. Read here to find out its complete implementation.

Just like Facebook Graph API, Twitter data can be accessed using the Twitter API as well. You can access all the data like tweets made by any user, the tweets containing a particular term or even a combination of terms, tweets done on the topic in a particular date range, etc.

Twitter data is a great resource for performing the tasks like opinion mining, sentiment analysis. For detailed usage of twitter API, read here.

IBM Watson offers a set of APIs for performing a host of complex tasks such as Tone analyzer, document conversion, personality insights, visual recognition, text to speech, speech to text, etc by using just few lines of code.

This set of APIs differ from the other APIs discussed so far, as they provide service for manipulating and deriving insights from the data. To know indepth details about this API, read here.

Quandl lets you invoke the time series information of a large number of stocks for the specified date range. The setting up of Quandl API is very easy and provides a great resource for projects like Stock price prediction, stock profiling, etc. Click here, to read more details about Quandl API.

 

6. List of 5 cool data science projects using API

I am sure that you are fascinated after reading about the above APIs, but wondering if you could a create project using these APIs which will be great value add to your CV?  Well, here’s the list of ideas you can start with. You can either use these APIs to retrieve data & manipulate it to extract insights from it or pass the data to these APIs & perform complex functions.

Here are the list of the projects for you. I’ll leave the execution of these ideas to you.

Further reads:

 

7. Welcome to the new Playground

Take a step back –  you have just got a glimpse of an entirely new world. Think of all the possibilities it enables – need face recognition on your mobile application – no worries! just invoke Google Face recognition API. Need to translate documents in Japanese to English – why not try Google Translate! The possibilities are limitless!

A few things to keep in mind while you think of building and using APIs: