A brief Note about Application Programming Interface

Posted on 26 December, 2016

Setu ’16 was an initiative which was a well-planned and well-researched concept of making an aspiring IT professional aware about the essentialities for a successful and a perfect corporate break. All the speakers have examined and researched thoroughly before finalising their topic of speech, and I was one of them. My first topic was such which can mould the career preference of the students, you can have a look at it on my blog, “Ensure Quality and Functionality of a Software as an effective Tester”. So I thought to choose my second topic which has a knowledge-based value for them. The Knowledge which they can utilise before entering the corporate world and even after that. I had a long brainstorming session with my own self and I made a decision to talk upon a topic called “Application Programming Interface” widely known as “API”. When we listen to the word API, the first thing that comes to our mind is GUI of applications. Well, it is a shallow feature from an ocean of features that API offers.

The term "API" is made up of three technical words

Application which means any piece of software made to fulfil a specific need

Programming stands for the process of writing a code to generate a software and

Interface is something which is programmed to generate a medium of communication between two systems or application.

Thus if we put all these things together, we land upon a definition of API as, “ It is a set of a program which helps different applications to communicate with each other which can allow the access to some features of other application”. In computer language, it is described as a set of subroutine definitions, protocols, and tools for building application software.

Now, the question comes “Why one needs an API?”.

It is often that we cannot do some task on our own because of the reasons like either we are not permitted to do it or we are not capable of doing it. Say for example, if you want to build a house will you alone be able to construct it? Or say you want to open a bank account, even though it will be your own account and your own hard-earned money, will you be able to open it on your own? Similarly, the software also needs to take access and help of other software to run certain programs. Thus, when one software wants to use or access the code of another software, it needs to send a request for it. Then this request is examined by another software and then it gives a limited access as per its protocol to the request received. All this is due to the presence of API. API acts as a middleman between this two software and transmits the request and the access to one another.

API is something which is used everywhere, like when you are messaging, if you copy something from your text message and paste it in the WhatsApp text space, it is an API that makes it possible. A programmer who develops an application which can support Android then, (s)he definitely needs to use API from Android to make it accessible in the particular hardware. Nowadays the gaming series like subway surfers lent APIs from facebook and other social media which makes it possible for the gamers to share their achievements and invite their friends on the social media.

 Facebook provides its API on its distinct URL specifically generated for developers "https://developers.facebook.com/docs"

How do APIs works?

An API is a middleman as stated previously, thus when one software say Software A wants an API(a certain set of code and access) from another software say Software B, then Software will send a request to Software B and after the process Software B will send the response back to Software A.

To make it simpler let's see a real life example; get a flashback of you sitting in a restaurant with your friend. The first thing you do is taking a menu in your hand and surfing what to have for the starters. Now what will be the next step? Will you go inside the kitchen area of the restaurant and will cook the food you want to order or you will go inside and let the chef know about your choices? Nope, you just need to place an order to get the food you want being at your own place! Here comes the role of a waiter. He takes an order from you and communicate it to the chef and later after cooking is done waiter serves you with your ordered food. Similarly, if one needs to access data from anybody else's system then (s)he needs to ask for it and the other party has to respond to it. Here both have their own pie of advantage in doing this, either in terms of publicity or say extra features.

We use many apps and websites which are using APIs of another software but being an end-users we could not make it out. When we book our flight tickets from “Makemytrip” and the options and prices of different airways are displayed on the single screen, is because Makemytrip has requested an APIs of all these airways. Similarly, when sometimes you are having your e-commerce shopping then instead of having your new account, Ecommerce app or site will give you the option to get logged in through your Facebook account. This is because of the API of facebook that is inbuilt in the eCommerce app or the site.

Types of API

There are various classification available for types of API, but largely there are two classifications which are useful from the scratch to the most advanced form of coding and interfaces. A glimpse of it is as follows:

1. Web Service: Here the interfaces between two applications or software can take place only when the systems are connected with internet facility. The interaction here takes place through XML language thus Web services are interoperable and is independent of any language or operating system. Web services make it possible that Java can have an interface with pearl and Windows can have its interface with Linux or ubuntu. There are few APIs which can be used through Web services like:

A. REST: REST API stands for Representational State Transfer. Basically, it only works with “HTTP” extension with verbs like (GET/POST/DELETE). It supports multiple data format. REST can be consumed by any client, even a web browser with Ajax & Java script. To some extent, security is a major issue with this high in demand API. REST API from Amazon, google and facebook all faces the issue of security as there is no encryption and sometimes only the username is required and not the password to certain elements and thus it cracks the wall of security.

B. SOAP: SOAP stands for Simple Object Access Protocol. SOAP is an XML-based protocol for exchanging information between computers. SOAP specifies exactly how to encode an HTTP header and an XML file so that a program in one computer can call a program in another computer and pass along information. Thus it is a communication protocol. SOAP is platform and language independent. It is quite simple and one can extend it as per his or he use. SOAP allows you to get around firewalls.

C. XML-RPC: XML-RPC is a remote procedure call (RPC) protocol which uses XML to encode its calls and HTTP as a transport mechanism. "XML-RPC" also refers generically to the use of XML for remote procedure call, independently of the specific protocol.This is the simplest XML-based protocol for exchanging information between computers. XML-RPC is a simple protocol that uses XML messages to perform RPCs. Requests are encoded in XML and sent via HTTP POST.

D. WSDL: The Web Services Description Language is an XML-based interface definition language that is used for describing the functionality offered by a web service. WSDL is an XML-based language for describing web services and how to access them. WSDL is an XML-based protocol for information exchange in decentralised and distributed environments.

2. Library-based APIs 

To use this type of API, an application will reference or import a library of code or of binary functions, and use the functions/routines from that library to perform actions and exchange information. These are those API which does not need the internet every time you use it. You can save it in your library for future use. One of the examples of Library-based API is SQLAPI++ library.

The major difference between Web services and Library based API is web service needs an internet connectivity and library-based API do not need internet connectivity every time we use it.

This is how API works and it is becoming an essential part of many online industries like eCommerce, comparative sites etc. 

As a Sr. Project Manager of ERP Applications at Emipro, I have been a part of a wide variety of projects for big businesses. Most of the projects used API directly or indirectly and API was a core for them to function. Be it Amazon-ERP integration, Ebay-ERP integration or integration to Magento with ERP. The role of API in business integration is unbelievable, without API a modern business cannot function to its maximum efficiency. I sometimes wonder, what if there was no API? What would I be doing to solve the business needs? How hard would it be? The world without API is unimaginable. I mean it!

It’s time to sign off, hope my topics have interested you and will make a difference in your career chart. Meet you at SETU 2017!


Dipesh Tanna , Odoo Project Manager
SETU

Post Your Review

X

Your Review has been posted

0 Comment(s)