New answer (now that I understand REST better):
PUT is merely a statement of what content the service should, from now on, use to render representations of the resource identified by the client; POST is a statement of what content the service should, from now on, contain (possibly duplicated) but it's up to the server how to identify that content.
PUT x
(if x
identifies a resource): "Replace the content of the resource identified by x
with my content."
PUT x
(if x
does not identify a resource): "Create a new resource containing my content and use x
to identify it."
POST x
: "Store my content and give me an identifier that I can use to identify a resource (old or new) containing said content (possibly mixed with other content). Said resource should be identical or subordinate to that which x
identifies." "y's resource is subordinate to x's resource" is typically but not necessarily implemented by making y a subpath of x (e.g. x = /foo
and y = /foo/bar
) and modifying the representation(s) of x's resource to reflect the existence of a new resource, e.g. with a hyperlink to y's resource and some metadata. Only the latter is really essential to good design, as URLs are opaque in REST -- you're supposed to use hypermedia instead of client-side URL construction to traverse the service anyways.
In REST, there's no such thing as a resource containing "content". I refer as "content" to data that the service uses to render representations consistently. It typically consists of some related rows in a database or a file (e.g. an image file). It's up to the service to convert the user's content into something the service can use, e.g. converting a JSON payload into SQL statements.
Original answer (might be easier to read):
PUT /something
(if /something
already exists): "Take whatever you have at /something
and replace it with what I give you."
PUT /something
(if /something
does not already exist): "Take what I give you and put it at /something
."
POST /something
: "Take what I give you and put it anywhere you want under /something
as long as you give me its URL when you're done."