PUT to create a resource: should the server create a resource or a container?

Hello,

https://solidproject.org/TR/protocol

PUT requests can target a non-existent resource. As a server, how do I know if the client wants to create a directory or a resource? Does the Link: header trick from next paragraph applies? If so, why does the next paragraph only mentions POST?

If the Link header trick applies, does that mean that all PUT requests to a container should include it, just in case the target does not exist?

Hi Vivien, welcome to the forums! I think the relevant section is 3.1 URI Slash Semantics:

Paths ending with a slash denote a container resource.

In other words, if the PUT request is to a URL ending in a /, the client wants to create a directory, and if it doesn’t, a regular resource.

3 Likes

This is the relevant answer I was looking for. Thank you.

3 Likes