Web APIs — What and Why?
Introduction
A Web API or Web Application Programming Interface is a framework which facilitates the provision of services and data to different devices such as laptops, mobile devices etc. A web API can be accessed through HTTP. Simply put, it is an API for the web.
A web API is a web development concept and is limited to the client-side of the web application and details about the webserver or the web browser are not included.
It can be built using technologies such as Java, ASP.net etc. It is an ideal platform to build REST-ful services over the .NET framework. Hence, a web API can be seen as an enhanced form of a web application.
Features of Web APIs
- Web APIs work with HTTP verbs: GET, POST, PUT and DELETE. Hence it supports: create, read, update and delete actions
- Multiple text formats such as XML, JSON etc. are supported
- Supports self-hosting
- Non-object-oriented content such as PDFs and images may get accepted and generated
- Open-source
Web API Version History
- Web API 1.0
>.NET Framework 4.0
> ASP.NET MVC 4
> VS 2010 - Web API 2.0
>.NET Framework 4.5
> ASP.NET MVC 5
> VS 2012, 2013
Why Use Web APIs?
In an era where technology is at the tip of our fingers, web-based applications alone are not sufficient to reach everyone on the internet. This is because most internet users are now using mobile devices and tablets to stay connected on the go. To expose data and services to everyone, these services need to be exposed as APIs compatible with every browser. For example, consider how Facebook is made available for the web application as well as the mobile app.
Web APIs are preferred to use with native applications that do not support SOAP but require web services. Furthermore, performance and fast development of services are enhanced with web APIs.
Another reason to use Web APIs is it enhances the development of lightweight and maintainable web services while supporting any text format (JSON, XML).
According to w3schools.com,
A Web API is a developer’s dream.
> It can extend the functionality of the browser
>It can greatly simplify complex functions
> It can provide easy syntax to complex code
Examples of popular Web APIs
- Google Geo-location API (Google Maps)
- Google Analytics
- YouTube
- Facebook Apps and Plugins
Limitations of Web APIs
- Latency — Generally this can be seen as the only limitation of web APIs. Latency is caused when there is a larger user base and synchronous calls are made to the API. This makes the processing time increase and the other requests wait in a queue. Another factor that causes latency is when the API is hosted on the other end of the world.