Hacker News new | ask | show | jobs
by Dashron 5264 days ago
Put is supposed to be Idempotent (http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1...).

calling "PUT a=b&c=d" three times should be identical to calling it once. So any time you let the system generate an ID for the resource you should use POST.

PUT works in creation when you know the id beforehand.

I have not worked with amazon s3 but I hear they handle this well. You PUT a file to a url containing the file name. The first PUT creates the file on their end, any future PUT updates that file.

1 comments

What's often left out is the reason that that's a useful rule to have: if PUTs are always idempotent, then you can always safely repeat a PUT if you're not sure whether it succeeded or not. This makes it easier to build robust systems.