It would have been nice if he proposed something innovative moving forward, but this is a step back to RPC-structured APIs. After reading this though, I had to check to make sure it wasn't April 1st.
I think the whole point the article is trying to make is that REST isn't really a step forward from RPC. It just adds an overly restrictive taxonomy (i.e. in a complex practical application, you're probably going to run into a problem that doesn't fit the REST model well), and doesn't actually solve any real problems.
Who Cares about GET vs. POST? NoREST
51–60 of 106 posts
Re: Who Cares about GET vs. POST? NoREST
#52Except that RPC-structured APIs are complete garbage to consume for external developers because, surprise, they don't know or care what your internal function names are. And if you aren't thinking about the experience of real or theoretical third-party developers when building your API, why even have one at all? If you ignore HTTP verbs and status codes you're just making it harder for other developers to grok your s…
They don't care what the internal function names are but they do care about the language of the domain, and if the internal program is well written then those will be one and the same. The HTTP verb model is inadequate for domains of realistic complexity; imagine a developer looking for the method that flubbleizes the worzwort. Is this POST /worzworts/12345 ? PATCH /worzworts/12345 ? If you squint at it then flubbleizing is kind of like adding another bishwiggle, so maybe it's PUT /worzworts/12345/bishwiggles ? Most people tend to realize that these domain-specific operations don't have a HTTP representation and instead make them a POST with the specific operation in the URL. But then you end up with an api that looks like:
#flubbleize a worzwort
POST /worzworts/12345/flubbleize
#mrefgle a worzwort
POST /worzworts/12345/mrefgle
#chezzle a worzwort
POST /worzworts/12345/chezzle
#delete a worzwort
DELETE /worzworts/12345
This ends up being less consistent, and more confusing to a developer, than simply using POST for every operation.> If you ignore HTTP verbs and status codes you're just making it harder for other developers to grok your system. It's less about adherence to some strict standard and more about helpful signaling. A GET fetches data, POST creates new records, PUT is idempotent, DELETE deletes. 4xx status codes indicate a request error, 5xx indicate a server error. That's all useful information for someone trying to integrate with your API, but you think that instead everyone should memorize your in-house conventions. Good luck getting buy-in on that.
The developer doesn't start by knowing that something is a PUT and trying to figure out what it's doing - they start by knowing what they want to do and trying to figure out the call. The world isn't consistent enough for them to be able to guess, and splitting the call into two parts - verb and path - makes it harder to remember once you've looked it up, not easier.
4xx vs 5xx is maybe valuable, but the very fact that you xx it suggests that the difference between 412 and 422 probably isn't important. In practice every REST API I've seen has felt the need to include a response body that a) explains the error and b) includes their own API-specific error code. In which case, why repeat yourself badly in the HTTP status code?
Re: Who Cares about GET vs. POST? NoREST
#53Earlier quoted context omitted.
Why, are external developers able to consume restful APIs without the need for any documentation on the system they're talking to? Aren't the various REST entities (and all the possible links between them, if you're doing HATEOAS) already part of a protocol the developers of external consumers need to know beforehand?
Sure, that sounds nice in theory. In the wild, how many developers (especially those working on internal APIs) have the time & inclination to thoroughly document their entire APIs? And if it exists, many developers read the entire spec of an API before beginning development? In my experience both are rare. Given the constraints developers often find themselves under, having an API that uses common patterns most devel…
Re: Who Cares about GET vs. POST? NoREST
#54Earlier quoted context omitted.
I think you've inadvertently put your figure on the part that really matters. REST is worse than SOAP or something like Thrift for discoverability, worse for ease of use, worse for practically every criterion you could think about. The one thing it does right is being easy to explore with a web browser. So optimize for that. Make it easy for a developer to look at your API with a web browser. This means simple URLs.…
> REST is worse than SOAP or something like Thrift for discoverability How? > worse for ease of use How? > worse for practically every criterion you could think about. I can think of lots of criteria, but very few on which I can see a compelling argument for REST being inferior to SOAP except "degree of support from libraries written to support SOAP".
Re: Who Cares about GET vs. POST? NoREST
#55Re: Who Cares about GET vs. POST? NoREST
#56The criticism they start with is weird. They take this API call: OrderDTO Customer::GetOrder(int customerID, int orderID) And this HTTP call: GET /customer/33245/order/8769 And ask: > If we put the function name between the parameters themselves, then it leads to the question, what part of this URL is the endpoint? But the thing that is between the parameters is "order" not the function name "GetOrder". If you look a…
> advocating abandoning it completely in favor of RPC-over-HTTP It surprises me that the author didn't go one step further and ask us to return to SOAP :)
Re: Who Cares about GET vs. POST? NoREST
#57Earlier quoted context omitted.
> REST is worse than SOAP or something like Thrift for discoverability How? > worse for ease of use How? > worse for practically every criterion you could think about. I can think of lots of criteria, but very few on which I can see a compelling argument for REST being inferior to SOAP except "degree of support from libraries written to support SOAP".
There's no WSDL or .thrift -equivalent for discovery, and no autogenerated client code which makes use harder. Getting up and running is slower because you have no way to validate that your messages are well-formed short of throwing them at the server and seeing what it sends back. What criteria are you seeing REST as better on?
Re: Who Cares about GET vs. POST? NoREST
#58Earlier quoted context omitted.
> Whether REST is a style or a standard is irrelevant Yes it is relevant.People right on HN spend their time arguing over what is restful and what isn't ,because vague "semantics". with RPC,no argument.And to be frank, if you're not using HATEOAS , there is very little difference between a api with beautiful urls and a few headers and rpc. The original spec is brilliant yet way to vague to be useful. RPC isn't HTTP,w…
> People right on HN spend their time arguing over what is restful and what isn't ,because vague "semantics". The defined semantics of HTTP/1.1 methods ( REST is a style, but HTTP/1.1 is a standard) are not vague. > And to be frank, if you're not using HATEOAS , there is very little difference between a api with beautiful urls and a few headers and rpc. If you aren't using HATEOAS, you aren't using REST. That doesn't…
Then almost no REST api i've seen out there the is a REST api,which is my point exactly.
If you're writing a spec almost nobody understands and almost nobody truly implements yet everybody think they implement, then you failed at writing that spec. Because I can guarantee you out there a only few people understand HATEOAS.
And that's the heart of the problem. The reason is easy. While the idea of using a few verbs, etags and content negotiation is easy, HATEOAS is hard,period.It's hard the person who implements the api ( because someone has to code all the logic representing these states, the links, ...) ,it's hard for the client: the client has to be smart, urls aren't hard coded but need to be fetched from somewhere , and the body of a response needs to be parsed to know in which state the resource is, the actions, the relationships between resources, or sometimes the links are in the headers... You're not just sending data but also metadatas (just like RPC) that are only relevant in the REST logic, not in the actual application logic ... you're basically writing a web bot every time you're writing a rest client... All that for what? elegance basically.
As your link says, most devs are just using RPC with beautiful urls to begin with and stamp "RESTfull" on that. Don't you think there is a real issue here? I do.
Re: Who Cares about GET vs. POST? NoREST
#59It would have been nice if he proposed something innovative moving forward, but this is a step back to RPC-structured APIs. After reading this though, I had to check to make sure it wasn't April 1st.
Gaining experience in technology is absolutely exhausting. Everyday there are posts, "New Shiny X!" and then six months later "Introducing No-X". Then a year later "New Shiny Y! Like X but without sesame seeds on the buns!"
Re: Who Cares about GET vs. POST? NoREST
#60There is no such thing as a RESTful URL. Characters in URLs don’t matter.
GET and POST have different semantics. Ignoring the benefits of caching is just dumb.
The semantics of status codes and verbs are defined pretty clearly. You might have to read an actual spec.
A paragraph starting with “A core difference between REST and RESTful …” physically hurts.
I can’t believe I just wasted time actually commenting on this.