What is REST actually?

 REST is about creating representation(like JSON or XML or any other format.) of object's current state(like data in database) and transferring that representation over network. Rest is the set of constraint/convention.

Resources are decoupled from their representation so that their content can be accessed in a variety of formats, such as HTML, XML, plain text, PDF, JPEG, JSON, and others. Metadata about the resource is available and used, for example, to control caching, detect transmission errors, negotiate the appropriate representation format, and perform authentication or access control

At ground level , Rest is nothing more but a collection of principles


  1.  Communication should be stateless : Server should not store any state . If required it should be part of message
  2.  State should be representational : Internally resource at server can be in one form but it should be able
  3. to change it representation. An object referenced by one URI can have different formats available. Different platforms need different formats. Mobile may need JSON whereas desktop may need XML
  4. . HTTP verbs like GET, POST, PUT, and DELETE must be followed religiously.
  5. . Resources should be addressable : Every resource on your network should have an specific address(specific URI)

REST vs HTTP (From )

The most significant constraints of REST that distinguish a RESTful application from just any HTTP application are : 

  1. Self-description : This constraint requires a RESTful request to be completely self descriptive in the users intent. This allows clients/proxies/caches to act on the message safely.
  2. HATEOAS(Hypermedia as the Engine of Application State ) : This constraint is about turning your application into a web of links where the client's current state is based on its place in that web. It is a tricky concept and requires more time to explain than I have right now.

Comments

  1. This is my doubt could you please help

    https://stackoverflow.com/questions/62612122/in-representational-state-transfer-what-does-state-transfer-exactly-mean

    ReplyDelete

Post a Comment

Popular posts from this blog

How to solve javax.net.ssl.SSLHandshakeException ?

When to use Java 8 Optional instead of traditional null pointer check ?