REST is a set of principles that define how Web standards, such as HTTP and URIs, are supposed to be used.
There are five important REST principle as mentioned below –
- Addressable Resources – Everything is a resource, each resource should be identified by a URI (unique identifier)
- Simple and Uniform Interfaces – REST is based on HTTP protocol so use HTTP GET, POST, PUT and DELETE method to perform actions. This make REST simple and uniform.
- Representation Oriented- Communication are done by representation. Representation of resources are exchanged. GET is used to return a representation and PUT, POST passes representation to the server so that underlying resources may change. Representation may be in many formats like XML, JSON etc.
- Communicate Stateless – An application may has state but there is no client session data stored on the server. Any session specific data should be held and maintained by the client and transferred to the server with each request as needed.
- Cacheable – Clients should be able to cache the responses for further use.