DEV Community

Discussion on: Opinion: PUT should be the HTTP method for new data

Collapse
 
jhechtf profile image
Jim Burbridge

Well, "POSTing" is simply a synonym for "PUTting up". Like I said, the two words get muddled because English.

If we want to be more technically correct, then really the argument becomes about the poor and forgotten PATCH verb, which I think is more technically in line with updating a resource. The issue is further compounded by the fact that you get slightly different language about PUT, POST and PATCH which muddle the meaning around them.

I agree that convention is largely useful, but sometimes the convention can (and should) be put into question. We can hold no things to be holy, simply because we are told that they are.

Collapse
 
ghost profile image
Ghost

POST is like posting an article in a paper, usually don't include the pk in DB, that depends on the implementation on said DB. Is a POST request, in this case the location is not part of the request is up to the receiver of said request.

PUT is the act of just put it there, when you PUT something in some place, location is in fact relevant, putting your hand in the hand of other to greet is very location sensitive, your hand should be in the others hand nowhere else. So the location should be included in the request, the receiver should refuse if the location requested is not available. In case of a DB if the requested pk is already taken or invalid. Is a request to add an entire entry.

PATCH should modify data a registry already in the DB, is for partial modifications of an entry, is different from PUT in that. To use PUT to update is against the convention.

That's how I understand it and makes sense to me, also, language is not always (ironically) literal in the strict sense; CPU is arguably not a unit, container and VM are very abstract and what about cookies, browsers, database, boot, uptime, etc. Technology is too fast, we end up reusing words not designed for it, as I said is a trade off, we should be making new words for new concepts; a screw is not called "rotating nail" nor hammers "heavy things with handles" after all, but imagine the extra mental load to learn thousands of technical new unrelated sets of letters for everything new. The web is not actually a web as we understood it a century ago.