breaking into the unknown…

what is API ??


API stands for application programming interface.  A no of definition and explanation is available on wiki here.  But the simpler example, I would give you is 3 pin electric plug, we all see in our home. The plug is basically, an interface to the electricity supply we are getting. We did’nt have to go into what going behind the plug like how the circuit is made,how the current is circulated, how it is produced etc. The interface user, like freeze, tv, radio etc simply connect to the plug and start getting the electricity. I have created a Sample API in this post

In the same, way in programming (system or software or hardware) we create an interface, so that other can use it. Infact, someone has said that a program without API is like a house without any door or window. Your application will become popular only by interacting with the outside world. Great example of this is Facebook and Twitter. Facebook has provide a no of API to retrieve its feeds, do signin, signup etc. It is upto you how much functionality, you want to expose to the outer world.

In Web development, API deals with handling request from outside the application and returning back a response to the requesting client. The request and response structure is predefined by API developer. The response is generally data in xml or json formate. Below lines I have taken from wiki, which add to my point

When used in the context of web development, an API is typically defined as a set of Hypertext Transfer Protocol (HTTP) request messages, along with a definition of the structure of response messages, which is usually in an Extensible Markup Language (XML) or JavaScript Object Notation (JSON) format. While “Web API” is virtually a synonym for web service, the recent trend (so-called Web 2.0) has been moving away from Simple Object Access Protocol (SOAP) based services towards more direct Representational State Transfer (REST) style communications. Web APIs allow the combination of multiple services into new applications known as mashups.

Now, I will give an example of API from one of my project, I have used it

We are working on digitising, documentation process for Applying loan with a bank . Due, to security risk, the bank can’t give us access to there database. But to implement our functionality, we need all the document associated with a loan, which we can put before the user to sign online. Thus our functionality will trigger once we have the document.

The client proposed the below scheme

-> User will login to the Bank portal with credential registered with the bank

-> He will see the loan he has applied for and also the list of document to be signed. when he will click on Sign Button, he will be redirected to my site with his user_id and loan_id

-> Using the user_id and loan_id, my application will made a API call to say the below dummy url

They are expecting xml request. So, The request body, should have below structure.


-> They also provided detail of security header i,e username, password, secret token etc each request should contain   in order to connect to their API
-> When request will be successful, we will get all the document detail in response in XML formate. They also told us detail of the response i,e at what xml nodes, the required data will be present.

Summary of Web API usage:

-> You should know the url to which you need to make the call

-> You should have access token detail as used by the API to make conection to it

-> Your request body should be in formate as defined by the API and carry all the required parameter

-> You should be able to handle the returned response.

Author: arunyadav4u

over 7 years experience in web development with Ruby on Rails.Involved in all stage of development lifecycle : requirement gathering, planing, coding, deployment & Knowledge transfer. I can adept to any situation, mixup very easily with people & can be a great friend.

7 thoughts on “what is API ??

  1. nice article full of good information. as a beginner developer I was using Google API but it has daily limitations. question is, can you recommend any free web search APIs, (apart from bing, yahoo, google,) I would like to test my ideas with something different. thanks.

  2. Pingback: Building a RESTful API in a Rails Application | MK(Ruby on Rails developer)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s