"Practically speaking there are only two HTTP verbs: read and write, GET and POST." And thus spoke someone who has never built a REST API, never used curl -I, and probably hasn't used anything other than a web browser to access HTTP content. Sure, for the most part, we're all kinda new to REST, and we're slowly learning to construct good REST architecture. Sure, there's some redundant weird shit like SPACEJUMP. But w…
Let's remove verbs from HTTP 2.0
91–100 of 141 posts
Re: Let's remove verbs from HTTP 2.0
#92Re: Let's remove verbs from HTTP 2.0
#93I also strongly disagree. The real problem is that browsers can't use them as good as they should. If you take for example a RESTful API, the verbs make totally sense and especially one of the mentioned verbs. PATCH is a great verbs if you use it like it was specified. I personally like the idea of giving more freedom to chose the verbs. Imagine you could use for a Twitter API something like: FOLLOW /users/123
> The real problem is that browsers can't use them as good as they should That's the obvious inevitability of having too many superfluous options. And one of the main thrusts of the article.
Re: Let's remove verbs from HTTP 2.0
#94Earlier quoted context omitted.
sure we have. have you read through the developer docs for most API's? here's twitters: https://dev.twitter.com/docs/api/1.1 its all GET and POST. this is typical.
I just wrote a REST API for my company and used PUT and DELETE (Tomcat doesn't support PATCH yet). Plenty of DELETE in Stripe's API: https://stripe.com/docs/api#delete_recipient Github uses HEAD, PATCH, PUT, and DELETE: http://developer.github.com/v3/#http-verbs Twilio supports PUT and DELETE: http://www.twilio.com/docs/api/rest/request There are all darlings of the HK community with highly praised, widely used REST…
Re: Let's remove verbs from HTTP 2.0
#95Re: Let's remove verbs from HTTP 2.0
#96"Practically speaking there are only two HTTP verbs: read and write, GET and POST." And thus spoke someone who has never built a REST API, never used curl -I, and probably hasn't used anything other than a web browser to access HTTP content. Sure, for the most part, we're all kinda new to REST, and we're slowly learning to construct good REST architecture. Sure, there's some redundant weird shit like SPACEJUMP. But w…
Huh? DELETE is rarely necessary nor semantic in HTTP. Personally, it's usually more often... -d"status=0" /document/ / Even on an FS, you are more likely semantically switching off its visibility or its fd and not necessarily destroying the underlying bits. The resources are then collected and destroyed at a later and in batch, kept forever in a deactivated state, or written over. And PUT is often a disaster, because…
So what? All of that is consistent with the semantics of HTTP's DELETE method. From RFC 2616:
9.7 DELETE
The DELETE method requests that the origin server delete
the resource identified by the Request-URI. This method
MAY be overridden by human intervention (or other means)
on the origin server. The client cannot be guaranteed
that the operation has been carried out, even if the
status code returned from the origin server indicates
that the action has been completed successfully.
However, the server SHOULD NOT indicate success unless,
at the time the response is given, it intends to delete
the resource or move it to an inaccessible location.
A successful response SHOULD be 200 (OK) if the response
includes an entity describing the status, 202 (Accepted)
if the action has not yet been enacted, or 204 (No
Content) if the action has been enacted but the response
does not include an entity.
If you are going to say that the semantics of an HTTP method are not right for a particular scenario, there should be something in your description of the scenario that is inconsistent with the semantics of the HTTP method in question.Re: Let's remove verbs from HTTP 2.0
#97Indeed, I'm constantly surprised that there aren't more "grand unified APIs" for dealing with HTTP. If there were, then we'd have better consensus on just how useless a lot of the HTTP spec has become, verbs included. It reminds me of the Java Servlet API - much of it became worthless with the advent of Struts and SpringMVC, as the front controller pattern better fit the mental model of people writing applications.
That said, GET, POST and HEAD are probably worth keeping around, because at least the first two imply something about the kind of idempotency your callers should expect, which is useful.
Re: Let's remove verbs from HTTP 2.0
#98I also strongly disagree. The real problem is that browsers can't use them as good as they should. If you take for example a RESTful API, the verbs make totally sense and especially one of the mentioned verbs. PATCH is a great verbs if you use it like it was specified. I personally like the idea of giving more freedom to chose the verbs. Imagine you could use for a Twitter API something like: FOLLOW /users/123
Ain't nobody got time for defining semantics.
Re: Let's remove verbs from HTTP 2.0
#99Earlier quoted context omitted.
The server can do whatever processing it likes to a PUT's request body. If you upload a PNG it can convert it to a JPEG or an SVG or OCR it or invert the colors, etc. It's perfectly valid to turn application/x-www-form-urlencoded into something else.
Converting "image/png" to "image/jpeg" is easy given a knowledge of those formats, but how do you convert "application/x-www-form-urlencoded" to "image/jpeg" or "text/html" or anything else? The only thing you can do is invent your own arbitrary convention, which begins to stray pretty far from the design and intent of PUT.
Since this problem isn't a barrier to using POST to create resources, it shouldn't be for PUT, either.
Re: Let's remove verbs from HTTP 2.0
#100When you think about it, any application can represent every piece of information coming from the outside world in unified data structure. That is, there is no real difference between headers, parameters, and body content (except, of course, in those cases where it is self-referential - for example, when a header tells you how to interpret the rest of the message. But even then one can write a totally generic functio…