What is an API and its types.
An API is an Application Programming Interface which is used for the interaction between two different systems .it’s functionality depends on the implementation of the user. To use API, no prior knowledge about how it is used in other applications is necessary.it doesn’t expose the implementation to those who shouldn’t have access to it.
These APIs are beneficial because they allow the developer to add additional functionality to an application without having to write proper code by themselves.
Working of API:
- A client sent a request to the server to access API.
- API server parses the request and queries to the database to act on the request.
- The server formats the response and sent it back to the client and client render the response based on their implementation.
HyperText Transfer Protocol(HTTP) and File Transfer Protocol(FTP) is used by the API to receive requests and send responses.
There are three major types of main web APIs:
Open APIs (public APIs)
These are available publically to all developers and other users without any restrictions.it requires API Key of registered or authenticated user to access and control services.ex: Microsoft makes Windows API public,eBay site.
These are the APIs generally exposed to business partners.these are usually exposed to public API developer portal that developer can access in self-service mode.there is a specific validation required to use partner API.for ex: Uber
Those API which hasn’t explicitly exposed to the developer. these API can change their access anytime in future.it acts as front end interface to back-end data and application function.
SOAP(simple object access protocol) APIs:
It is an XML based protocol for accessing over HTTP and also independent on language, platform.it requires standard tools with middleware support. the structure of SOAP is hard to use many developers prefer more of a REST framework due to its low complexity and has built-in error handling which makes it more reliable.
REST(Representational State Transfer):
It is an architectural style that makes use of widely adopted technology, more usually HTTP over XML.it provides a simple method for accessing web service.it is the fast as well as the most efficient method.it only requires URI for information exchange.
Popular API Examples:
- Youtube API: It helps developers integrate youtube videos and their functionality into their website and applications.
- Twitter API: It offers REST API to access Twitter data as well as Search API to interact with searching things & trending news.