What is REST API?
So here two words are REST and API, let me tell you about API first, API or Application Programming Interface is an interface that helps to interact with other applications or software.
Let’s understand with an example, You must have noticed in airline ticketing websites like ixigo, MakeMyTrip, Paytm and many more. How they can able to show inventory or availability of different airlines like Air India, indigo and Vistara in a single website? There must be a technology behind it. Yes, they are using API to interact with different third party applications of indigo, Vistara to fetch the inventory and update the booking status.
In a simple term, API is an interface between two application through which they can communicate with each other.
Not only for the third party websites we are using API, nowadays every single application developed using APIs. All application have their frontend and backend in different servers. For example in a microservice architecture, everything operated through API.
Okay, if it is the same application developed by an organisation they know what are the responses from the server, not only that they know the format of it but now the question is, how can anyone else understand those formats.
Here REST API came into the picture. REST is an acronym for REpresentational State Transfer. It means the server should respond with the standard representation or format of data so that any client can understand and execute in their application. It does not matter in which programming languages used in both client and server-side. So both can transfer the state of the data or object with each other.
In a client-server architecture, there must be a request from the client or you can say frontend and response from the server.
To request the server mainly four methods are there, GET, POST, PUT and DELETE and these HTTP methods are dedicated for different operation in server-side. get method is to get the data or read the data from the server. POST method is to create, PUT method to update and DELETE method is to delete the data from the server. These altogether called CRUD operations.
So we can perform CRUD operation using REST API.
REST API is stateless, it means, each request from the client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is therefore kept entirely on the client.
I hope, you understand, what is REST API. if don’t! please read again and comment below. Or you can connect me on Twitter.