Hello Daniel,

>apparently PUT updates an existing item if found

yes, and it creates it if not found. One important condition is that you 
know (by advance, if the resource does not exist yet) the resource's 
identifier (its URI).

POST is a more generalist operation that allows the target resource to 
act on its own state (if it exists...). It is used, for example, to 
create a resource when you don't know by advance its URI. By convention, 
you send a POST request to an "container" resource (such as "items"), 
and in return, you can get the URI of the created resource (if the 
container validates the request).

I hope this makes the things clearer.

Best regards,
Thierry Boileau

> hello everyone,
>
> I'm a new user working through the Restlet tutorials (Restlet 2.0m7,
> java 1.6, running standalone (no servlet container) from eclipse). So
> far I'm enjoying using Restlet, which seems very straightforward,
> especially compared to other java web technologies.
>
>   From the firstResource tutorial, I'm trying to understand the
> distinction between creating a new item via PUT (ItemResource) vs. POST
> (ItemsResource). The two methods appear to do the same thingâEUR"create a
> new ItemâEUR"with the only distinction being that apparently PUT updates an
> existing item if found whereas the POST implementation complains if you
> try to change or re-add an existing item.
>
> What is the rationale for this apparent duplication?
>
> Thanks in advance,
> dan
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2451651
>
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2451860

Reply via email to