SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Web API and Web Services Introduction

Web API
API (an application programming interface) is set of  rules, protocols, specifications and tools which allows two software programs to communicate with each other for developing software and application. It provides interface to communicate two different software programs to interact with each other if both follows API's protocols and rules. API is not user interface but it provides software to software interaction.

If you will do X thing by following rules of API, Y thing will happen. If you still not understand it then let me describe API with very simple example. 

I wants to TURN ON my TV which is operated by 230V AC current and 3 pins plug shape. Now supposing i have 4 different plugs as bellow.
  1. 2 Pins 120V AC
  2. 3 Pins 120V AC
  3. 2 Pins 230V AC
  4. 3 Pins 230V AC
So you tell me, Which plug can TURN ON my TV? Answer is 4th plug as my TV is operated by 230V AC current and 3 pins plug. So 4th plug is an API for my TV to TURN it ON.

API

But it will be 1st plug for your TV if it accept 120V AC current using 2 pins.

Same way, There is X website which provides current weather of different cities and also have an API which you can use to show current weather on your own website. So if you will send request to X website with their defined format, their API will replies with a structured response. Then you can use that response data to show current whether on your own website.

Let me take you in more practical way. You have your own eCommerce website. Now supposing you wants to create native apps for android and IOS device. So what you will do? You will code everything again for android and IOS app which is already coded for web application? Answer is No. That's not real way. Solution is : You have to create web API for different functions of your eCommerce website and then you can use that API in android and IOS apps to access and send data as per requirement. So same code of web application will be used by android and IOS app. So here, API is a layer using which you can send and request data between two different platforms.

Google Maps API,  YouTube API,  Flickr API,  Twitter API and Amazon Product Advertising API are popular examples of API.

Web Services
Web service is application component or we can say client server application which use standardized XML messaging system for communication over the internet. We can communicate two devices over the network using web service. Web services allows you to expose your existing code functionality over the internet and others can use that functionality on their website.

what is web services

Web service is independent from operating system and programming languages as it exchange information using XML. So you can establish information exchange between two different OS(Unix to Windows) and languages(Java to PHP) using web service.

Example :
  • Company X is running website which offer hotel booking service and peoples are very comfortable to book hotel through that website. Website is developed in Java.
  • Same way company Y is running flight booking website and it is also popular. Website is developed in PHP.
  • Now supposing company Z wants to build a site in .Net which offer hotel + flight booking service. So company Z have 2 options. Either develop everything on their own (Which can take more money, time and effort) or use existing website functionality of company X and Y.
  • So here company X and Y will expose their website code functionality using web services and company Z will use it to build their website. So here, Company Z don't need to code everything again as they will access and use company X and Y's functional code using web service.
Types of web services
There are mainly two types of web services available.
1. Big web services - Big web services follows SOAP(Simple Object Access Protocol) standard which use use XML messaging between web service to exchange the information.
2. RESTful Web Services - RESTful web services are based on the way how our web works.

No comments:

Post a comment