3 ms·
> why would it be better to POST to /addcomment than to POST to /comments ? Er, paul actually said PUT to the document (with no particular URI given). POSTing
by sapphirecat 18y ago
> why would it be better to POST to /addcomment than to POST to /comments ?
Er, paul actually said PUT to the document (with no particular URI given). POSTing to /comments vs. /addcomment is pretty much a moot point, but I think I agree that "PUT to the document" to add a comment is the wrong thing to do. PUT implies overwriting and should be idempotent. It seems to make sense for _editing_ comments, but the only way I could think of to create a comment that way is to have the client PUT the comment with a GUID. Which seems rather icky: do you want GUIDs messing up your pretty URI space with strings of junk?
- bct 18y agoI agree, which is why I said that people advocating PUT for commenting don't grok HTTP verbs. (I've never seen anybody advocate that.)
- sh1mmer 18y agoComments in this case would be a resource which is a container (of all comments) Posting to the container therefore makes sense as it's equivalent to a factory method to make a child of the container.