Select Page

What is Application Programming Interface(API) and different API types.

Jul 10, 2019 | Blog | 0 comments

What is an API and how does it work?

API stands for Application Programming Interface. API can be explained as a set of functions or subroutines or set of procedures or set of communication protocols, which is used to build software and applications.

Example 1:

Suppose you want to create a weather app or an app that can easily convert the currencies to a desired currency .Now you will think that this weather and currency both are changeable quantities and you alone can not keep track of those things. Then how can you build that app?

In this case, if you  get an access to the server of weather department or get an access into the database of stock exchange department then your work can be more easy .But question is that how can you fetch data from those servers, as your application is totally different from those  applications. You can do this with the help of API. It’s an

Example 2:

Suppose you have a confectionery shop in the middle of the city and you want to spread the business. So, decided to create an online website to sell those stuffs .But here is a twist, you want to link your tally based billing software with the website .So whenever there is an order appears into your website that order data will go to the software database. So how you can do this thing?

Here also the answer is API.API will help you to integrate these two platforms.

Example 3:

In modern application you have often seen that ,whenever you try to log in to these applications they are giving you the option to login using Google account or Facebook account .So here you can ask yourself, how these can be possible , as these applications are totally different from that of Google and Facebook. And these are not the child applications either of these two companies.

Here also, the API is helping you to do that thing. Application Programming Interface is extracting some data from Google’s or Facebook’s server and use it to login to their own applications.

API stands for Application Programming Interface. API can be explained as a set of functions or subroutines or set of procedures or set of communication protocols, which is used to build software and applications.

What is subroutine?

Subroutine is quite similar as the function in programming. Function is used to do repetitive tasks; you define some set of codes inside a function and whenever you need that function to execute in the code you just make a call of that function.

Subroutine is also like function. Within the subroutines we define some set of codes for execution and you make call to that subroutine for execution.

Then what is the difference between subroutine and function?

In case of function, it returns a value after the execution but subroutine does not return a value compulsorily, rather it does execute the code or instructions and stop execution after the end of the codes and inform the main program about its completion.

What is synchronous programming?

Synchronous instructions are something like step by step instructions. A computer program runs from the first line of code to the last line in step by step way, means after completing the first line of code it starts to execute the second line of code and so on.

Example of synchronous application:

In real life operation you have often seen such application where you have to fill up a form  with some information as well as have to upload a photo to the form. In that case, after clicking on the photo upload button , you’ve to wait for some seconds to complete the process. After that only, you can fill up the other options in the form. So this is an example of synchronous application where you can do the next job after completion of the previous job.

What is asynchronous programming?

Asynchronous programming is a parallel programming where a unit of code runs parallel with the main application thread in a separate place .Whenever there is a requirement to run that piece of code we CALL that code. After the execution of its code it inform the calling thread about it’s completion.

Example of asynchronous application:

In the previous example if we use an asynchronous programming at the time of photo uploading then, you can go to the next options on the form to fill them immediately after clicking the photo upload button. And when the upload will be completed it will only notify you about the completion of the uploading. So you do not need to wait for some seconds for uploading.

Types of API:

There are mainly four types of API used for different purposes.

Public API: These types of API are publicly available. Anyone can use these API to build software or applications. There is thousands of open API available in the internet. As for example – Google’s API; most of the Google’s API are available at free of cost. If you want to integrate Google’s map in your application, you can easily get those API from Google.

Private API: These types of API are mainly used for company’s internal purposes. To integrate different products or software modules within the same company these types of API are used. These are not available for public or any third party.

Partner API: This types of API are used to integrate two different applications of two different companies .There is an agreement between the two companies for the use of their api . The limitations of applicability of such api are also made at this time. In such scenarios owner imposes some specific rights, license agreement, authorization and security protocols on the use of their api to others .

Composite API: Composite API is something like suppose you’ve made an API CALL; so some pieces of code will get executed for that call. And the outcome of that code will be taken as the input to another API and the outcome of this API will initiate another API execution .So in this way a single API CALL can execute multiple APIs synchronously .This type of API is called as Composite API.

Web API:

There are mainly four types of web API available in the market .Such as –


Before we discuss the individual web APIs ,their functionalities ,let us know what is web service.web service is a set of software application through which two different application can communicate with each other on the world wide web .In web service communication the client application makes a request to the server and get the response from that server. This communication mechanism is constructed with Medium and Format .Medium is the http protocol, over which the communication is made. Format is the common understandable language, using which the two different applications communicate. XML (Extensible Mark-up Language ) , JSON are the examples of format in web service. XML is widely used format language for web communication.

In web service communication the client application makes a request to the server and get the response from that server.

Why XML is used as a data transfer language?

Suppose there is an application, written in .net, wants to communicate with another application over the World Wide Web ; But this application is written in java. So how can this be possible as the two platforms are made of two different languages? For this reason XML (Extensible Mark-up Language ) is used. XML is platform independent language. Most of the programming languages understand XML based message.

There are several types of web services available but we will discuss about two main types –SOAP and REST web services.

World Wide Web consortium (W3C) defines the different standards and rules for different web services. According to that, we can depict a web service whether it’s a soap or rest or other web service.

SOAP Web Service:

In this type of web service, the Protocol is HTTP and the format used in this case is XML . This XML format must be in XML message format .This XML message contains one Envelope element, within which one Header and one Body element exist.

REST Web Service:

REpresentational State Transfer. This is an architectural style service. In this type of web service message format is JSON or XML or HTML or Txt etc. and HTTP is the protocol for communication. To access resources (such as picture, video, documents etc.) in the server we can use REST service call from browser.

What is Representational State in rest web services?

If we want to get access to the server resources, such as picture, video, song, document, user data etc. then we make a call to get those data. In Rest web services we do not get access to the server data but instead of that we get a REpresentational response or a copy of the requested resource.

How to get the detail functionality of web service from a service provider ?

For this reason WSDL or Web Service Description Language has been developed. Every web service provider has to publish their web service detail, all the return types, parameters, how to access their web services, and detail functionalities of their web services in an XML based document.

Every web service provider has to publish this WSDL document through an online directory, called UDDI or. Universal Description Discovery and Integration. This is also an XML based online directory through which web services publisher can publish their services and any consumer can consume the services.

Difference between web services and API:

  • Web service needs network connection to communicate with client. But in API, it can communicate through network and offline basis .If the library file exist within the server or within the client application then no need to have the network. In c, java programming you often include library file within the local application .In this case main java program (or c program)can communicate with library file without having the network connection.
  • Web service support soap, REST and XML- RPC based web services. API supports all of these services as well as it supports JSON RPC, curl based services.It can be constructed with local  jar,dll, XML format and can communicate over http, JSON protocol.
  • So all web services can be stated as API but all API can not be imagined as web services.
API vs web Service. application interface programming,what is apis.


We have already discussed about the soap web service .The functionality is same for both the case. The only difference is that in case of soap api you have to use it as an interface between your server and the client. SOAP means Simple Object Access Protocol.


Here is also the functionalities or working principles are the same REST Web service. In case of API you have to use it as an interface.

Quick example of Application Programming Interface and web services, how do they work together:

Suppose you are selling the same products from Amazon as well as from eBay .Now whenever you want to upload products to these online websites, you have to upload it into both sites. In these cases you are interacting with Amazon and eBay web services directly from your device. Now if you want to use any warehouse website to upload these products. Then you do not need to upload them at individual websites manually. What you just have to do ,is that you’ve to upload that  product at warehouse website and the warehouse api will interact with these two web services and upload your product into their websites. In this case generally curl methodology is used to call the web services.


RPC stands for Remote Procedure Call. From its name it’s clear that some sort of Procedure ( procedure is similar to function in programming) is situated at remote location and it is CALLed from another system or application. So in this type of application client does not execute whole codes; rather , it execute the codes at remote server using remote procedure call .Whenever the codes get executed the result is revert back to client.

XML and JSON are used as the format message for exchanging data between the server and client; according to which the RPC is divided into two groups namely XML-RPC and JSON-RPC.

Google API:

 There are a bunch of Google’s api available for free use .Google’s map,googles login, Google authentication, Google calendars etc. Go to following link to see the detail about Google’s API –

Flickr API:

Flickr APIallow developers to work with Flickr.They can upload, modify or retry photo at Flickr.They can use Flickr APIto integrate Flickr photo to their website also .Go to following link to see the Flickr API-

Also Read-

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Pin It on Pinterest

Share This