All you do is Insignificant but it is important that you do it.

REST API’s

Rest basically means using current features of web in simple and effective way.
Features of Web :
Old and widely accepted HTTP protocol.
This HTTP protocol has 4 methods – GET, POST, PUT and DELETE
HTTP protocol is stateless.
URI- Uniform resource identifier via which we locate any service on the web.

REST takes these principles from web and applies certain principles to them and that is what is called as REST; It is nothing but architectural style built on certain principles using the current HTTP “Web” fundamentals.
There are five basic fundamentals in HTTP web which we are leveraged to create web services.

It uses a simple and uniform interface; simplification is a way to success i.e the goal of REST is to have uniform interfaces. When external clients are interacting with my service; they expect a simplified interface. For e.g If I have a customer that orders data, which I have exposed on the web and these are some function names by which external client can communicate
Add Customer
Insert orders
Select Customer
Get orders
Delete Customer
Remove orders
Update customer

The above methods seem to be inconsistent and difficult to remember, this is what REST says; keep your interfaces uniform and simple. This can be achieved by uniform method of HTTP protocol and combining the name with resource operation. In HTTP protocol, there are lots of common methods e.g creating, updating, deleting etc.

Method Description

GET Gets a resource
PUT Creates and updates a resource
POST Submit data to resource
DELETE Deletes a resource

The above are traditional methods and if we can get these traditional methods and combine with our resource, then our interface can be made uniform. If we combine the HTTP methods to the REST uniform API, we can have it better, for example if a customer is to be added, then we can send HTTP PUT request to REST i.e customer/shiv.
Uniform interfaces is nothing but your old combination of HTTP’s POST, GET, PUT, DELETE with our resource names. By doing this, we can achieve a simplified communication.

4th Principle-Everything is a Representation

All communications are done via representations, example if there is a client, a server and inside the server, there are resources; whenever the client sends some data to server and server sends back a response, everything is done via representations, so any kind of req and response which goes from the client to the server and back again is nothing but representations.
If you want to make a new customer record, what should you do?

All the requests and responses from client to server are called as representations.

5th Principle-Be Stateless
Every request should be an independent request, so that we can scale up using load balance etc. Independent requests means, with the data, you also send the state of the request, so that with the service, we can carry forward the same for the next level.

GeetikaBatra.com

ghsgja#45445

Above representation sends user ID and password to a system so that it can be validated. we may get this back.

true

Let us say that we want to go and search a customer. Now, we will send a representation and we will also say that we are currently logged in successfully and do not again ask us the user ID and password. So we will set something like flag