Search code examples
restasp.net-web-apiresources

What is "Representation State" in REST archtecture


I'm trying to understand the principles of REST architecture, but I'm struggle to understand what the Representational State is and how it is transferred.

Also, here, I encountered the concept "representation of a resource". What is the meaning of "representation of a resource"? This abstraction confuses me...

From Roy Fielding's Ph.D. dissertation:

“Representational State Transfer is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.”

Maybe, a simple example will help to understand the abstraction.


Solution

  • You can take a look at this tutorial

    Learn REST: A RESTful Tutorial

    They break down the meanings of the abstractions, which should clear up any confusions you may be having in understanding.

    Basically the resource represents a thing. There can be different representations of a resource. Think of it like different shapes of an item or thing.

    Representations:

    • How resources get manipulated
    • Part of the resource state
      • Transferred between client and server
    • Typically JSON or XML
    • Example:

      • Resource: person (Todd)
      • Service: contact information (GET)
      • Representation:
        • name, address, phone number
        • JSON or XML format

    The video really tries to explain the topic in a way that is very understandable. They explain the Roy Fielding doctoral dissertation found at

    http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm