top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

A quick Introduction to REST API!

What is API?

Applications developed with JavaScript, sitting in windows, wants to access the application (developed with PHP) sitting in Linux machine. How is that possible? Yes, API does that.

API is Application programming Interface, which allows two software applications talk with each other, regardless of their platform.


Example:

I am developing a website, in which I want to display the map to provide the location. Google makes my job easy. It provides the map API, which can be used to get the map service developed by google and display it in my website.


Client Server Communication:


Server provides the API and the client use it to communicate with the server to get the information needed.


REST API


REST API is one of the API which is most used nowadays. REST stands for Representational State transfer. It provides a set of guidelines or standards.


Guidelines can be thought of as a contract of service between two applications. This contract defines how the two communicate with each other using requests and responses.


The API follows those standards or are called RESTful API.




The guidelines provide by REST are,



REST uses the HTTP protocol to request, access and manipulate data on a computer system.

When using REST, the requests made can be by both HTTP and HTTPS protocols.


The HTTP methods like GET,POST,PUT,DELETE is used by the client to make the request.


Data exchange formats used in REST is JSON, XML, etc.


Since, REST is Stateless. Each request from the client is new to the server.


Client makes the HTTP request and Server provides the HTTP response, in which Data is provided in the format like JSON. Client will parse the JSON format, to get the information it is requested to the server.

Let’s see a simple example, Web browser is a client, it requests (Makes HTTP request with GET method) web pages from the server, to display the HTML page. Server sends the HTML page (as HTTP Response), but in JSON data format to the browser(client). Now browser parse the JSON format and gets the data to construct the HTML Page.


Happy Learning!





85 views0 comments

Recent Posts

See All
bottom of page