WHAT IS REST API
RESTFUL API or Rest API is the most popular API. In REST API , REST stands for Representational State Transfer and API stands for Application Program Interface. It is a code that allows software programs to communicate with each other. It defines correct way to write a program that request services from an operating system or other application.
How API Works?
API’s are made of two related elements. The first is specification that describes how information is exchanged between programs, done in the form of request for processing and a return of necessary data.
The second is a software interface written to that specification and published in some way for use.
Let’s understand working of API with an example:
When you use an application on your mobile connected with internet and sends it to the server. Server retrieves that data, interprets it, performs the necessary action and sends it back to your phone. The application then interprets that data and presents you with the information you wanted in readable way. This is what an API is. This all happens via API’s.
In layman language –imagine you are sitting in a cafeteria you want to drink coffee. You will tell your order to the waiter. Than waiter will go to the kitchen chief will make coffee. After that, waiter will deliver coffee for you. Here waiter is acted as API.
A RESTFul API is an application program interface that uses HTTP request to GET, POST and DELETE data.
Because of REST API’s use HTTP, they can be used by practically any programming language and easy to test. While REST can be used over nearly any protocol, it usually takes advantage of HTTP when used for web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design.
However, there are drawbacks of Restful API design. You can lose ability to maintain state in REST, such as within session, it is more difficult for newer developer to use.