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

Re: Question regarding POST versus PUT for creating an LDPC

From: Eric Prud'hommeaux <eric@w3.org>
Date: Wed, 17 Apr 2013 06:38:01 -0400
To: Cody Burleson <cody.burleson@base22.com>
Cc: Linked Data Platform WG <public-ldp-wg@w3.org>
Message-ID: <20130417103800.GA16514@w3.org>
* Cody Burleson <cody.burleson@base22.com> [2013-04-16 23:37-0500]
> Team,
> I'm curious of your opinion.
> I have been feverishly trying to catch up, where time permits, by trying my
> hand at implementing what is specified thus far (in Java, as a layer atop
> Tomcat).
> One area where I'm having doubts is on what might be the more logical HTTP
> method for the creation of an LDPC. POST or PUT?
> I kind of get the feeling that the spec, as it stands, seems to imply that
> PUT is the better method. But I'm not so sure.
> In your experience, is there a convention for CREATE? It just doesn't seem
> clear to me that one is intended over the other. I suppose both could be
> supported, but what would be the majority expectation?
> Or does it matter?
> Sorry - I know I'm not really contributing yet, but rather - just asking
> more questions. But I think, perhaps, that once I get my code up to a point
> where it's starting to have good coverage, it may start to reveal some real
> questions and issues that could add value. So, bear with me (and be gentle).

If the client knows or has control over the name of the resource to be
created, it should PUT the contents to the new location. There are
several problems with this caveat:

1 PUTting a resource names that aren't cryptographically unique means
  it's likely that some client has already created that resource,
  e.g. all clients try all the time to create container/item1.

2 The server implementation might constrain the names of the resources
  it can store and serve, e.g. one backed by a database which stores
  only an integer which it concatonates unto "container/item".

For these reasons, LDP also supports the common web convention of
POSTing to a factory to create new resources. In LDP's case, that
factory is called a container and there is a prescribed protocol and
media language for talking to it.

Hope I answered the right question.

> -- 
> Cody Burleson

Received on Wednesday, 17 April 2013 10:38:37 UTC

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