freme-project / e-Link

Apache License 2.0
0 stars 0 forks source link

PUT template with uknown id #31

Closed ghsnd closed 9 years ago

ghsnd commented 9 years ago

When a template is PUT to a resource that does not exist yet, it creates one, even if the documentation only says it modifies existing templates. Is this correct behaviour? E.g.:

curl -v -d @sometemplate.ttl -X PUT -H "Content-Type: application/json" "http://localhost:8080/e-link/templates/5001"

creates a new template with id 5001.

m1ci commented 9 years ago

Yes, this is correct behaviour. It was implemented according to the definition of HTTP PUT method http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6

If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.