W3C home > Mailing lists > Public > public-ldp-wg@w3.org > April 2013

Re: Question regarding POST versus PUT for creating an LDPC

From: Wilde, Erik <Erik.Wilde@emc.com>
Date: Fri, 19 Apr 2013 11:40:08 -0400
To: Andy Seaborne <andy.seaborne@epimorphics.com>, David Wood <david@3roundstones.com>
CC: "public-ldp-wg@w3.org" <public-ldp-wg@w3.org>
Message-ID: <CD96B0E5.E694%erik.wilde@emc.com>
hello andy.

On 2013-04-19 07:41 , "Andy Seaborne" <andy.seaborne@epimorphics.com>
wrote:
>On 19/04/13 14:25, David Wood wrote:
>> On Apr 19, 2013, at 09:21, Andy Seaborne
>><andy.seaborne@epimorphics.com> wrote:
>>>A container of colors.
>>> I want to add an entry for "black" and I want the name to
>>> be /colors/black.

keep in mind that /colors being the container and /colors/black being an
item in it is an implementation convention (some URI pattern you prefer)
and not something that is a general constraint of LDP. you could very well
imagine a scenario with the same logical things (container of colors and
color items) with the URIs being like this:

container: http://example.com/container/colors
colors: http://example.com/items/black

>>>PUTting to /colors/black and then linking seems a natural way to do
>>>that.
>>> I don't want container generated names - I want to control the name.

but as pointed out above, you never have full control. you're a client.

>>How is this different from POSTing to container /colors/ with a Slug of
>>'black'?
>Generally: the suggestion was to advise strongly again using PUT to
>create.  But that's a natural use of HTTP.  We seem to be creating a
>general framework in abstract discussion, and then rolling that that
>back over existing patterns.
>So why is PUT to create bad whereas PUT to replace is good?

it's not bad, but it needs to be driven by hypermedia. Slug defines this
by encoding server-controlled magic to use some input string and generate
an output URI. if you don't want this, you must have some other kind of
rule that tells clients what they can try to PUT. when you say "black", it
seems kind of obvious what you're trying to do, but can you use names of
1000 characters? can you use non-ASCII? can you use URI special characters
such as path separators?

>>If the server respects the slug, you get what you want.  If it doesn't,
>>you were never going to get the URL you desire anyway.
>An indication of rejection is better than 200 and mutating the URI.

maybe you prefer to be rejected in this scenario (an i am wondering: is
that true for most people in this use case?). if you try to PUT
/colors/black and it gets rejected because the server decided that all
entries in all of its containers MUST be of the form /items/{string}, how
do you tell a client? how can a client recover from being rejected?

cheers,

dret.
Received on Friday, 19 April 2013 15:41:08 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:11:46 UTC