What does Representational State mean in REST?

前端 未结 8 745
执笔经年
执笔经年 2021-01-30 02:58

I have been reading all over the net to get the exact meaning of two words:

REPRESENTATIONAL STATE

I have a doubt. I am misunderstanding these terms. i want to

相关标签:
8条回答
  • 2021-01-30 03:48

    I think that the whole question about the concern of the REST architectural style, goes around to understanding, that the author, Roy Fielding, had in his mind to suggest in his dissertation, a set of architectural principles to build architectures based on the hipertext or hipermedia paradigm.

    This paradigm, I think, is the central key to understand this important topic.

    Behind the style of organizing a client-server application's architecture proposed by Roy Fielding, I think there is a specific idea of a modern client-server application, that consists by a sort of engine to govern application state transition, whose states are potentially extensible to infinite.

    In this vision, the Ipertext\Ipermedia is the center of the whole architectural style proposed by Fielding and the key concept that allows this paradigm to work is the "representational (state) transfer".

    I think that "representational" refers to the concept about the "transfer", instead of the concept about "state", that is, it is the transfer to be representational (of a representational type), and that is, in my opinion, the main cause of the name "Representational State Transfer".

    So, designing a Restful application, it is design first an architecture based on a web of components, each of them comunicates with others in a client-server layered architecture model, sending each of them a representation of its state.

    And so, the front-end, the first client of this architecture, transits through its states showing rapresentation of the states sended by the component, or components, that it calls endorsing on a uniform consistent interface and not on a "private" api.

    A such type of application, in the mind of the author, is potentially extensible to infinite states, because its states don't depend on a private api, but depend on a univoque identifier system (as URI) shared by all agents in this architecture, on a few some verbs to manage transion of its states and on an agreed shared representational transfer system, or plus.

    This transition ends with communication of its representation to the called server component via the verbs that compose the "public" api, which should belong to the stateless communication protocol used by components client-server.

    In a such way, this client-server components interaction consists in interchanging (transferring, communicating) representations of components states of using a stateless protocol.

    And the core concept that allows all these architectures to potentially extend itself to infinite is the representational transfer that endorse their architecture.

    0 讨论(0)
  • 2021-01-30 03:48

    Imagine a state diagram - the following will do.

    If this were the set of web pages, you would start at Undergraduate landing page for a student. Per the diagram, when you would click on the "Next" link, it will take you to Freshman page - assume the student has graduated. By clicking on "next" multiple times, you get to the last page.

    Of course, there could be other transitions like "Home" allowing you to jump to the default page.

    The visible state of the website has nothing to with how server implements this association internally - that is the internal states. It may involve multiple databases, servers and what not. A student may graduate and his/her status may have been updated via other methods. The client is not aware of these details - but can always expect to get a coherent visible state (set) for human (or machine) consumption.

    Another example: As you are looking at this page, you in a particular identifiable and reproducible "location" in the StackOverFlow web hierarchy.

    So, RESTful State deals with navigation.

    0 讨论(0)
提交回复
热议问题