Re: Question about resource and representation

On 14/11/2016 6:08 p.m., Yi, EungJun wrote:
> Hi,
> 
> 
> According to RFC 7231, a representation is a state of a given resource
> 
> 
>    For the purposes of HTTP, a "representation" is information that is
>    intended to reflect a past, current, or desired state of a given
>    resource, in a format that can be readily communicated via the
>    protocol, and that consists of a set of representation metadata and a
>    potentially unbounded stream of representation data.
> 
> 
> and a payload in a POST request is also a representation.
> 
> 
>    The POST method requests that the target resource process the
>    representation enclosed in the request according to the resource's
>    own specific semantics.
> 
> 
> Then what is the resource which the representation enclosed in the
> POST request reflects? I think the representation may not reflect a
> state of the target resource for the POST request.
> 

For POST there are three resources involved;

 1) the server script/app receiving the POST is a resource (target
resource in the POST URL)

 2) the processing states that scripts code logic (semantics) can go
through.

 3) the resulting server data state is a resource (response resource).


The payload of the POST relates most directly to (2). It is not a
physical "thing" resource, just a logical set of processing states.



Just like other messages the payload of a POST could be in either
plain-text or compressed form. But as long as the uncompressed data is
the same set of values the two representations result in the same
logical processing by the server.


HTH
Amos

Received on Monday, 14 November 2016 05:41:50 UTC