Hello, Guys I here with an article on API and its types.
API(Application Programming Interface) is a set of tools to build software. It is an interface that allows one application to talk to another application through simple codes. For those who understand what API is will surely be helped a lot with this, cause this makes easy for the development of apps. It saves a lot of time in development as it has a predefined set of codes inside the API. APIs are used when programming graphical user interface (GUI) components.
If we talk about working it simply gets the request from the user via some script and provides the data according to the request
Nowadays every good web app has API of its own, with which we can integrate our app to it using their API. There are various examples of which the best example is Facebook, it offers users the ability to sign in to many apps and Web sites using their Facebook ID—a feature that relies upon Facebook APIs to work.
When you book a ride with OLA cabs it connects to its API which has all the details of the drivers in your area, and then it connects you to the nearby driver. The drivers also receive your data the same way using API. When you again try to locate your driver is connected to google map API and gives you the current location of the driver in google map.
We are using API in almost all the websites, you see a share or like button on this page, it is also connected using the respective API’s. Which allows the user to share the post or like the page without leaving this page.
Some times API can go wrong
Of course, just because an API is available now, that doesn’t mean it always will be. Twitter, for instance, notoriously limited third-party applications’ use of its APIs just over a year ago—a move that had the practical effect of killing off alternative Twitter clients and driving users to Twitter’s own site and apps, where Twitter can “monetize” them by displaying ads … er, promoted tweets. Twitter insisted the move was necessary to deliver a “unified” Twitter experience.
There are some types of API web services
- SOAP (Simple Object Access Protocol)
- REST (Representational state transfer)
SOAP: SOAP is a protocol that defines the communication method, and the structure of the messages. The data transfer format is XML. SOAP allows a proprietary XML format.
XML-RPC: It is also XML data format but older than SOAP, but it uses specific XML format for data transfer whereas SOAP allows a proprietary XML format.
JSON-RPC: JSON-RPC is same as XML-RPC but uses JSON format instead of XML.
REST: It not a protocol but architectural principles. This architecture differentiates REST from other APIs. Some of the characteristics required of a REST service include simplicity of interfaces, identification of resources within the request, and the ability to manipulate the resources via the interface. There are a number of other, more fundamental architectural requirements too. It is one of the easiest web services that are accessible, REST services tend to offer an easy-to-parse URL structure, consisting primarily of nouns that reflect the logical, hierarchical categories of the data on offer. The most commonly used data format is JSON or XML, you can use either by including “JSON” or “XML” in the URL path.
For example, you want to get the list of all Carlist from car.com
and further you want only Maruti cars provided you know the name of that category in API
and furthermore classified like you know the name of the model for eg alto your request will look like
REST is a widely used API for any programming language.
Also published on Medium.