Subject: Question about resource and representation

From: "Yi, EungJun" <[email-masked]>
Date: Mon, 14 Nov 2016 05:08:42 +0000

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.

Thanks in advance.

Best regards,

EungJun

---

From: Mike Bishop <[email-masked]>
Date: Mon, 14 Nov 2016 05:25:52 +0000

Interesting philosophical question.

In the sense that POST is different from PUT (representation is desired end state) or PATCH (representation is difference between current state and desired state), that’s true.  You can’t necessary look at the request and the result of a GET and predict the end state of the resource after the POST.

But consider that “the resource’s own specific semantics” can be treated as a function that takes some input and produces a desired state.  POST, in effect, says “I know that function, and here’s the input required to create the desired state.”  An observer doesn’t know the function, but that’s irrelevant if the client and server do.  And if they both do, then the input is “a format that can be readily communicated.”

From: Yi, EungJun [mailto:[email-masked]]
Sent: Monday, November 14, 2016 2:09 PM
To: [email-masked]
Subject: Question about resource and representation

Hi,

   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.

Thanks in advance.

Best regards,

EungJun

---

From: Amos Jeffries <[email-masked]>
Date: Mon, 14 Nov 2016 18:41:08 +1300

> 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

---

From: "Yi, EungJun" <[email-masked]>
Date: Mon, 14 Nov 2016 07:32:59 +0000

Thanks to Amos and Mike for your great advices!

Thanks to your help, I could correct my understanding about representation
as follows.

1. A representation is an information to be intended to reflect a state of
a given resource, but not needed to be the state itself.

2. The target resource for a POST request may not be the resource that the
representation in the request reflects.

3. An implementor of a HTTP server which serves a POST request should
define a resource that the representation in the request reflects, if they
wants to make their server satisfies the semantics of the HTTP
specification.

---

From: Mark Baker <[email-masked]>
Date: Mon, 14 Nov 2016 22:35:32 -0500

On Mon, Nov 14, 2016 at 12:08 AM, Yi, EungJun <[email-masked]> wrote:
> Then what is the resource which the representation enclosed in the POST
> request reflects?

It is unknown, unless a Content-Location header is present in the request.

---

From: Mark Nottingham <[email-masked]>
Date: Mon, 21 Nov 2016 14:56:13 +1100

See:
  http://httpwg.org/specs/rfc7231.html#identifying.payload

Cheers,

> On 15 Nov. 2016, at 2:35 pm, Mark Baker <[email-masked]> wrote:
> 

--
Mark Nottingham   https://www.mnot.net/