TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How did REST come to mean the opposite of REST?

398 pointsby edoficalmost 3 years ago

80 comments

Joerialmost 3 years ago
<i>The client knows nothing about the API end points associated with this data, except via URLs and hypermedia controls (links and forms) discoverable within the HTML itself. If the state of the resource changes such that the allowable actions available on that resource change (for example, if the account goes into overdraft) then the HTML response would change to show the new set of actions available.</i><p>If the client knows nothing about the meaning of the responses, it cannot do anything with them but show them to a human for interpretation. This would suggest a restful api is not made for system-to-system communication, but requires human mediation at every step of the way, which is precisely not how api’s are used. In short, this definition of restful api’s can’t be right, because it suggests restful interfaces aren’t api’s at all. Once a programmer adds code to parse the responses and extract meaningful data, treating the restful interface as an api, the tight coupling between client and server reappears.
评论 #32143486 未加载
评论 #32143976 未加载
评论 #32144390 未加载
评论 #32144258 未加载
评论 #32143579 未加载
评论 #32147084 未加载
评论 #32143822 未加载
评论 #32143714 未加载
评论 #32146551 未加载
评论 #32143658 未加载
评论 #32149431 未加载
评论 #32147412 未加载
评论 #32148971 未加载
评论 #32148278 未加载
评论 #32144755 未加载
评论 #32144299 未加载
评论 #32149601 未加载
ocimbotealmost 3 years ago
I feel old for I have witnessed many of these battles. But I feel that I have seen history.<p>There&#x27;s nothing wrong in this article, in the sense that everything&#x27;s correct and right. But it is an old person&#x27;s battle (figuratively, no offense to the author intended, I&#x27;m that old person sometimes).<p>It would be like your grandparents correcting today&#x27;s authors on their grammar. You may be right historically and normatively, but everyone does and says differently and, in real life, usage prevails over norms.<p>Same goes for REST.
评论 #32143568 未加载
评论 #32144015 未加载
评论 #32144203 未加载
评论 #32143496 未加载
评论 #32143825 未加载
评论 #32143889 未加载
评论 #32147984 未加载
rrauenzaalmost 3 years ago
I feel like the author has conflated hypertext with html.<p>The REST interface should be self describing, but that can be done in JSON.<p>If you go to Roy Fielding&#x27;s post... there is a comment where someone asks for clarification, and he responds:<p>&gt; When I say hypertext, I mean the simultaneous presentation of information and controls such that the information becomes the affordance through which the user (or automaton) obtains choices and selects actions. Hypermedia is just an expansion on what text means to include temporal anchors within a media stream; most researchers have dropped the distinction.<p>&gt; Hypertext does not need to be HTML on a browser. Machines can follow links when they understand the data format and relationship types.<p>So, to me, a proper format is something like...<p>id: 1234<p>url: <a href="http:&#x2F;&#x2F;...&#x2F;1234" rel="nofollow">http:&#x2F;&#x2F;...&#x2F;1234</a><p>name: foo<p>department: <a href="http:&#x2F;&#x2F;...&#x2F;department&#x2F;5555" rel="nofollow">http:&#x2F;&#x2F;...&#x2F;department&#x2F;5555</a><p>projects: <a href="http:&#x2F;&#x2F;...&#x2F;projects&#x2F;?user_id=1234" rel="nofollow">http:&#x2F;&#x2F;...&#x2F;projects&#x2F;?user_id=1234</a><p>This is hypertext in the sense that I can jump around (even in a browser that renders the urls clickable) to other resources related to this resource.
评论 #32144103 未加载
评论 #32144424 未加载
评论 #32144072 未加载
jancialmost 3 years ago
Because HATEOAS is stupid for client-server communication.<p>It mandates discoverability of resources, but no sane client will go around and request random server-provided urls to discover what is available.<p>On the other hand, it does not provide means to describe semantics of the resource properties, nor its data type or structure. So the client must have knowledge on the resources structure beforehand.<p>Under HATEOAS the client would need to associate the knowledge of resource structure with a particular resource received. A promising identifier for this association would be the resource collection path, i.e. the URL.<p>If the client needs to know the URLs, why have them in the response?<p>Other problems include creating new resource - how the client is supposed to know the structure of to-be created resource, if there is none yet? The client has nothing to request to discover the resource structure and associations.<p>Also hypertext does not map well to JSON. In JSON you can not differenciate between data and metadata (i.e. links to other resources). To accomodate, you need to wrap or nest the real data to make side-room for metadata. Then you get ugly and hard to work with JSON responses. It maps pretty good to XML (i.e. metadata attributes or metadata namespace), but understandably nobody wants to work with XML.<p>And the list goes on and on.
评论 #32143918 未加载
评论 #32143730 未加载
评论 #32144300 未加载
评论 #32144085 未加载
throwaway787544almost 3 years ago
Excellent explanation. But I think plenty of technology has been misunderstood as of late.<p>I&#x27;ve been in this industry two decades, but it&#x27;s only in the past 5 years that I&#x27;ve noticed entire teams of <i>absolute morons</i> entering the field and being given six figure jobs without understanding what their job even is, much less how to do it properly. (And by &quot;properly&quot; I mean &quot;know what a REST API is&quot;)<p>The industry is awash in quants who took a four week course in Python and are now called &quot;data scientists&quot;; backend software engineers who don&#x27;t know what the fuck a 500 error is; senior developers who graduated a year ago; engineering managers who &quot;hire DevOps&quot;; product managers and DMs who don&#x27;t know how to use Jira or run a stand-up. It&#x27;s like all that&#x27;s left is people who think they have &quot;impostor syndrome&quot; when they actually are impostors of professionals.<p>I tried to find a new job recently, and I couldn&#x27;t find a single org with at least 50% of the staff properly understanding how to do their jobs. Of course half of them were bullshit VC-funded money-bleeding terrible businesses, and the other half were fat cash cows that through their industry dominance became lazy and stupid. Maybe we just hit peak tech, and all the good teams were formed by boring companies long ago and don&#x27;t have new positions open. Or maybe all the good people cashed out and retired.
评论 #32151101 未加载
munk-aalmost 3 years ago
The short answer is... the web moved in a different way than expected and the useful portions of rest were preserved while other portions were jettisoned (the biggest one IMO isn&#x27;t the hypertext portion (JSONs fine, it&#x27;s <i>fine</i>) but the self-discoverable portion - I haven&#x27;t seen a self-discoverable REST API <i>ever</i> in the wild).<p>Unfortunately the name REST was too awesome sounding and short - so we&#x27;ve never had a fork with a different name that has proclaimed itself as something more accurate.<p>I don&#x27;t think this is awful, FYI - it&#x27;s sort of the evolution of tech... the OG REST wouldn&#x27;t have ever gotten popular due to how stringent it was and I can use &quot;That it&#x27;s RESTful enough.&quot; to reject bad code practices without anyone being able to call me out on it because nobody actually remembers what REST was supposed to be.<p>I&#x27;d also add - what precisely is self-descriptive HTML? All descriptions need reference points and nothing will be universally comprehensible - let alone to a machine... expecting a machine to understand what &quot;Insert tendies for stonks.&quot; on an endpoint is unreasonable.
评论 #32144130 未加载
评论 #32143811 未加载
评论 #32144006 未加载
评论 #32143553 未加载
评论 #32143712 未加载
eterevskyalmost 3 years ago
If you are designing a REST API, please don&#x27;t follow this author&#x27;s advice and return HTML instead of JSON. HTML takes much longer to parse and makes the API more fragile.<p>The history did its job: it preserved the most useful features of the original idea (expressing RPCs as URLs in GET and POST requests) and has dropped the unnecessarily complicated bits.<p>What this article is about is a pedantic terminology battle of whether to call the current practice REST or not.
评论 #32149472 未加载
评论 #32148270 未加载
评论 #32148627 未加载
stuckinhellalmost 3 years ago
Software Development is like water filling a container. It&#x27;s always water but its form takes the shape of its container.<p>After doing this for 15+ years, I tell my junior developers to take it easy on the &quot;proper way&quot; of doing things. It will change, people will argue, and money talks.
评论 #32143937 未加载
potamicalmost 3 years ago
Great article. Calling APIs RESTful because they return JSON has always been a peeve of mine. But here&#x27;s the question though, why do APIs need to be RESTful? What is the need for a client to have no knowledge of the server, if the server can also provide logic that can run on the client. In some sense, one could argue that a service that provides both raw data and client logic to transform raw data to hypermedia, is still very much in the spirit of REST. Webapps by definition must satisfy this requirement, so it is moot to be asking if a webapp follows RESTful principles. Of course it does, it runs on the web! Native apps on the other hand have sure ruined everything.
评论 #32143492 未加载
评论 #32143316 未加载
评论 #32144676 未加载
femto113almost 3 years ago
There are two fundamental reasons HATEOS just doesn&#x27;t work in practice. The first is that most services can&#x27;t easily or reliably know their own absolute URLs , and HATEOS (and the behavior of many HTTP libraries) is inconsistent around relative URLs, so hacky and unmaintainable response rewriting gets applied at various levels. The second is that if you are diligently following a convention for how paths are constructed it&#x27;s utterly redundant information--you can simply synthesize any path you need more easily than you can grok it out of HATEOS. The reasonable bits of REST that are left are not just HTTP verbs and JSON, but significantly the use of entity type names and ids in the path portion of the URL rather than in query parameters.
quickthrower2almost 3 years ago
I never understood this and still don’t.<p>The P in API is programmer’s. Specifically it is a programattic call.<p>REST says you get hyperlinks, which are effectively documentation in the response.<p>Which is nice.<p>But a program isn’t a person it doesn’t need docs in the response.<p>And URL links are not sufficient documentation to use the interface.<p>So I don’t get the REST use case outside of some university AI project where your program might try to “make sense”’of the API.<p>And therefore I have never tried to use REST and I have never seen anyone else either at anywhere I have worked.<p>It is a nonsense concept to me.<p>REST API is a contradiction in terms.
评论 #32148029 未加载
评论 #32147279 未加载
twoodfinalmost 3 years ago
This article does a disservice to the benefits of “Richardson Maturity Level 2” i.e. “Use REST verbs”.<p>A standard set of methods—with agreed upon semantics—is a huge architectural advantage over arbitrary “kingdom of nouns” RPC.<p>I’d argue that by the time your API is consistently using URLs for all resources and HTTP verbs correctly for all methods to manipulate those resources, you’ve achieved tremendous gains over an RPC model even without HATEOAS.
评论 #32146703 未加载
评论 #32147682 未加载
评论 #32145725 未加载
kelseyfrogalmost 3 years ago
An earnest answer? Because few people have taken the couple hours(?) and read Roy Fielding&#x27;s dissertation from start to finish. The biggest likely reason for not doing so is that frankly a bunch of people simply don&#x27;t care, and why should they. There&#x27;s very little incentive to do so. In fact, the fewer people that do, the less of an incentive there is - there is no one can call them out on it and they can reap the rewards of calling an API RESTful despite the accuracy of the statement.<p>Having worked in an organization where people were very familiar with the academic definition of REST, the biggest benefit of being a backend developer was that when client-side folks depended on nonRESTful behavior, we had some authority to back that claim. It gave us leeway in making some optimizations we couldn&#x27;t have made otherwise, and we got to stick to RFCs to resolve many disputes rather than use organizational power to force someone to break compliance to standards. I suppose it meant that we were often free to bikeshed other aspects of design instead.
评论 #32143993 未加载
评论 #32144041 未加载
评论 #32146733 未加载
评论 #32149664 未加载
lloydatkinsonalmost 3 years ago
At this point I’ve stopped caring about REST. It’s like agile and scrum where everyone says they are doing it but everyone has their own opinion of what’s correct.<p>As long as there’s an OpenAPI spec, sane API routes, and it uses a format that’s easily consumable with a given ecosystem (so pretty much always JSON anyway), and it doesn’t do anything dumb like return 200OK { error: true } then I’m happy with it. Too much bikeshedding.<p>Bonus points if the API has a client library also.
评论 #32143227 未加载
weeksiealmost 3 years ago
The usefulness of metadata in rest responses ended up not mattering as much as people thought in most cases. Pagination is the best counter example but many rest apis do return next&#x2F;prev links in the payload or in the headers. It’s still REST but the parts that mattered (http verbs for semantic info, etc) stayed around.
danielovichdkalmost 3 years ago
Seems strange to me that people fight over REST since it is very clearly communicated in the mentioned PhD dissertation.<p>I fully understand the movement of complexity, historically belonging on the server, shifted just as much on to the client, but that&#x27;s not a discussion of being restful - it&#x27;s not restful to have the client determine application state so to speak - the server does that for you.<p>In the sense of catering multiple clients via an API is of tremendous value but you still moved the complexity on to the client - you cannot argue against that.<p>I find it fascinating to have at least blobs of state&#x2F;representation being served without having to fiddle with inner workings of an API and simply rely on the API to give me what I must show the user.<p>I am in the HATEOES camp, it sit well with me. But that&#x27;s just me
ineptechalmost 3 years ago
I regularly interview devs and ask, &quot;What makes a RESTful API RESTful?&quot; and have never heard anyone mention hypertext or hypermedia. A typical answer is: stateless, uses HTTP and HTTP verbs, and (if the person is over 40) easier to read than SOAP.<p>Related, it seems like &quot;API&quot; is quickly becoming synonymous with &quot;web service API&quot;. In my experience, the thing that goes between two classes is almost always referred to as an &quot;interface&quot; only.
评论 #32143808 未加载
评论 #32143745 未加载
aheppalmost 3 years ago
I&#x27;m walking away from this article unable to find a really good reason to implement HATEOAS in an API meant to be consumed by a program (as Application Programming Interfaces typically are).<p>The best I can come up with (and this is me <i>trying</i> to like it) is that I guess the API is somewhat self documenting?<p>I see benefits to resource orientation and statelessness, but why do people get so upset about these APIs not following HATEOAS? Is it just a form of pedantry, that it&#x27;s not <i>really</i> a REST API, it&#x27;s a sparkling JSON-RPC?
评论 #32147499 未加载
civilizedalmost 3 years ago
Because no one knows what the hell the acronym means, except that it sounds good.<p>Everyone wants to be RESTful. RESTful is chill. It&#x27;s resting - good programmers are lazy! But RESTful is resting <i>while using an acronym</i>, which is technical and sophisticated. To be RESTful is to be one of the <i>smart</i> lazy ones.<p>Now if you&#x27;re one of the few who cares what your acronyms mean, you look it up and ... &quot;representational state transfer&quot;. How do you transfer state without representing it? I guess <i>everything</i> that transfers state is RESTful. And everything is state, so everything that transfers is RESTful. So every API is RESTful! Great, I guess if we make an API we&#x27;re one of those cool smart and lazy people. And let&#x27;s make sure to call it RESTful so that everyone knows how cool, smart, and lazy-yet-technical we are.<p>Roy Fielding made a meaningless but cool-sounding acronym popular and has reaped the predictable consequences.
评论 #32147288 未加载
评论 #32149886 未加载
etamponialmost 3 years ago
REST, noun, acronym.<p>1. A term to indicate APIs that use HTTP as the transport protocol, and typically JSON as representation.<p>2. (archaic) A term conied in a paper from 2000, indicating a model that describes how the internet works.
评论 #32146509 未加载
cgrealyalmost 3 years ago
It&#x27;s down to utility.<p>It turns out that using JSON is easy, has good support and is relatively compact on the wire.<p>It also turns out that using HTTP verbs and transferring the entire state of an object makes development easier.<p>And equally, for 99% of use cases, it turns out that HATEOAS is nice but not necessary.
sanderjdalmost 3 years ago
I remember wasting a huge amount of time on this debate over a decade ago. Frankly, I think the issue is that HATEOAS is not useful enough. It&#x27;s a really nice idea, but in practice nobody actually wants to write an API client that way. So they don&#x27;t. So API creators don&#x27;t optimize for it. I consider all of RPC, GraphQL, and bastardized-REST systems to be less elegant but more pragmatic than &quot;true REST&quot;. I can still palpably feel how refreshing it was when I finally went to work somewhere that didn&#x27;t bother with this whole debate and just focused on building good RPC interfaces. More people should embrace that.
Aprechealmost 3 years ago
If an API is truly RESTful does that automatically mean it&#x27;s a high quality API? Does that mean it is functional, performant, reliable, secure, and generally well designed? No. An API can be RESTful and also trash. An API can also be non-REST and be amazing.<p>Is the author correct in that APIs are inaccurately calling themselves RESTful? Yes, yes they are very correct. Congratulations. Here&#x27;s a trophy for being correct. Now let&#x27;s focus on what matters, and that is building software that works and works well, REST or not.<p>Please dump the pedantry and focus on practicality.
haroldpalmost 3 years ago
Por que no los dos? You can build a &quot;real&quot; restful API by returning HTML or JSON based on the request&#x27;s suffix or HTTP-Accept value. Hit it with a web browser and get a nice &quot;home page&quot; that says, &quot;This is my very cool API. Here are links to various endpoints. Make your requests with &#x27;Accept: application&#x2F;json&#x27; header, or end the request path in &#x27;.json&#x27; to get a JSON response&quot;. Delightfully discoverable and self-documenting.
geenatalmost 3 years ago
It may be time to re-visit this approach now that HTML5 is fully matured.<p>HTML5 was only just released in 2014, and took many years to be fully supported by major browsers.<p>At the time of JSON vs HTML, HTML was not yet in a standard place yet (XML API implementations were extremely inconsistent).<p>Fast forward to 2022, fetching &lt;div&gt; and &lt;a&gt; is an elegant pattern, and probably the way to go for self documenting API in the future!
dvtalmost 3 years ago
This post tries to clarify things, but it&#x27;s extremely confused and kinda&#x27; wrong. First, REST is a type of (distributed) architecture and really has nothing to do with how data is sent over the wire (as long as it&#x27;s &quot;hypermedia&quot;). The claim that RESTful state <i>has</i> to be transferred via HTML is plain wrong[1].<p>Second, a JSON response is simply that: a bunch of data in JSON format. It is <i>not</i> JSON-RPC. JSON-RPC, unlike REST, is a <i>protocol</i> -- a way a client talks to a server -- and it usually looks like this:<p><pre><code> --&gt; {&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;method&quot;: &quot;subtract&quot;, &quot;params&quot;: [42, 23], &quot;id&quot;: 1} &lt;-- {&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;result&quot;: 19, &quot;id&quot;: 1} --&gt; {&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;method&quot;: &quot;subtract&quot;, &quot;params&quot;: [23, 42], &quot;id&quot;: 2} &lt;-- {&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;result&quot;: -19, &quot;id&quot;: 2} </code></pre> XML-RPC is the same thing, but done with XML instead of JSON.<p>&gt; The entire networking model of the application moved over to the JSON RPC style.<p>No, it didn&#x27;t. Well, actually, I don&#x27;t know exactly <i>what</i> &quot;networking model&quot; means in this case. Pretty sure we&#x27;re still using TCP&#x2F;IP. But I think it means the data-layer protocol; this is, however, <i>still</i> wrong. We&#x27;re actually using HTTP methods (also known as RESTful verbs[2]) along with a JSON data format. This is still quite screwed up in the grand scheme of things, but in different ways than the article argues.<p>[1] According to the man himself, in fact: <a href="https:&#x2F;&#x2F;restfulapi.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;restfulapi.net&#x2F;</a><p>[2] A terribly confusing term
lmmalmost 3 years ago
Two simple factors: 1) We needed a word for using JSON and HTTP statuses instead of treating HTTP as a &quot;transport&quot; for opaque SOAP payloads 2) Actual &quot;REST&quot; (i.e. HATEOS) is utterly useless and has never been successfuly implemented (except to the extent that the web itself qualifies), so the word was going free.
optimuspaulalmost 3 years ago
Anarchy, it always has been. Everyone has their own ideas about what REST means or what Hypermedia means.
评论 #32146750 未加载
benjiweberalmost 3 years ago
Semantic Diffusion comes for everything. See also everyone calling the thing they use to avoid integration &quot;CI&quot;.
评论 #32143551 未加载
moth-fuzzalmost 3 years ago
Is there <i>actually</i> an API out there that actually qualifies as RESTful, other than the WWW itself? When you really take the time to consider the spirit of RESTfulness, and the designs and constraints of hypermedia in general, I can&#x27;t really think of anything other than just... websites on the internet. Or some WWW-like that might not be transferred over HTTP nor use HTML but would be functionally the same regardless (and far less popular).<p>It seems that trying to build a hypermedia API in the spirit <i>of</i> hypermedia precludes someone actually designing an app with any particularity (themes, layouts, pages, certain requests&#x2F;responses being valid&#x2F;invalid, etc.), since it must be so general, the only client application that could qualify is the web browser itself - able to render any HTML document without actually knowing about the document semantically. Because having prior semantic knowledge of the API violates REST. Assuming that, are the &#x27;apps&#x27; and APIs one would design then just hypermedia documents? Sounds like web 1.0. Not necessarily a <i>bad</i> thing, really, but REST seems too specific to be meaningful outside of websites, either that or I&#x27;m not imaginative enough.<p>I&#x27;m not sure what a &#x27;hypermedia API&#x27; looks like that isn&#x27;t just a web page or a functional equivalent thereof. It seems that either the WWW is the REST reference implementation or REST is simply the architecture of the WWW codified.
z9znzalmost 3 years ago
Author says that the json is not self-describing, but the html example is... That&#x27;s true if &quot;self describing&quot; means &quot;describes html structure&quot;.<p>Perhaps modern use of the term REST is officially incorrect, but I think most REST clients really need to understand what they are receiving. How many rest clients merely show the result (as-is) to the human user? No, most clients are themselves programs which need to consume the response and make further decisions.<p>Imaging having to parse out the official REST HTML response to get the balance of the account. I hope the source is only in one language, because I would hate to have to build my own reverse-localization system just to make sense of the REST response I just consumed.<p>I was really trying to grasp why someone would build such a tall soapbox to complain about the incorrect use of a term, when the correct use would mean building arguably near-useless APIs. But then I took a look at what the htmx site is all about. It&#x27;s about everything-as-html. &quot;Note that when you are using htmx, on the server side you typically respond with HTML, not JSON. This keeps you firmly within the original web programming model, using Hypertext As The Engine Of Application State without even needing to really understand that concept.&quot;<p>Looking at the rest of their site, I&#x27;m finding it very difficult to see the value proposition over the current approach of JSON APIs.
评论 #32148731 未加载
headbeealmost 3 years ago
I see this argument made assuming that REST service creators are not aware of L3 REST but the fact that it never caught on is at least some proof of its ill-fitness to the general problem. Nowadays we have many more options that do what L3 REST tries to do (OData, GraphQL, etc) and most APIs at least conform to L2 REST. This is a classic case of friction between design intention and actual user experience: there was a push-door with a handle, and users aren&#x27;t using the handle, they&#x27;re just pushing it.
fabian2kalmost 3 years ago
The term is used wrong most of the time now, if you try to be more precise you&#x27;re likely to confuse people not aware of the original meaning of REST. And there&#x27;s not a really nice term for JSON-based web API that is as short as REST.<p>Many web APIs are not REST, but still take at least a tiny bit of inspiration from it. Mostly the resource-based structure, not so much any of the other stuff like HATOAS. In practice the self-describing nature simply isn&#x27;t useful enough, so most people don&#x27;t bother.
Barreraalmost 3 years ago
Several commenters take the position that the distinction doesn&#x27;t matter. This is &quot;an old person&#x27;s battle.&quot; What matters is getting things done.<p>I&#x27;m not so sure. For one thing, it&#x27;s of both theoretical and practical interest to trace the path of how a technical term comes to mean its opposite over time. If you&#x27;re in the business of creating technical terms (everyone building technologies is), you might learn something by studying the REST story.<p>For one thing, Fielding&#x27;s writing is not exactly approachable. REST is described in a PhD dissertation that is dense, packed with jargon and footnotes, and almost devoid of graphics or examples. His scarce later writings on REST were not much better.<p>Others who thought they understood Fielding, but who could write&#x2F;speak better than him, came along with different ideas. Their ideas stuck and Fielding&#x27;s didn&#x27;t because he wrote like an academic and they did not.<p>The other thing that happened is that the technological ground shifted. To even begin to understand Fielding requires forgetting much or all of what one knows about modern web technologies. Part of that shift is the timing of Fielding&#x27;s rediscovery with deep frustration over XML&#x2F;RPC.
评论 #32144235 未加载
评论 #32144189 未加载
shadowgovtalmost 3 years ago
The hidden cost of using hypermedia in REST has always been that hypermedia is machine-hostile. It has been for years.<p>So a format intended for machine-to-machine communication is taking on huge cost adopting a full hypermedia format for its output. Ignoring the initial question of &quot;What version of hypermedia&quot; (i.e. are we doing full modern HTML? Can I embed JavaScript in this response and expect the client to interpret it?), that&#x27;s just overkill when 99% of the time the client and the server both understand the format of the data and don&#x27;t need the supporting infrastructure a full hypermedia REST implementation provides.<p>For the same reasons XML-RPC more-or-less lost the fight, HTML (as a not-very-lightweight subset of XML) was going to lose the fight.<p>That having been said, there are some great ideas from the REST approach that can make a lot of sense with a JSON payload (such as standardizing on URLs as the way foreign resources are accessed, so your client doesn&#x27;t have to interpret different references to other resources in different ways). But using HTML-on-the-wire isn&#x27;t generally one of them; it&#x27;s a solution looking for a problem that brings a full flotilla of problems with it.
bazoom42almost 3 years ago
Bottom line: REST+HATEOAS is great for distributed hypermedia consumed and navigated by humans.<p>It is just not a practical architecture for API’s.
ribitalmost 3 years ago
I am not quite sold on the dichotomy between “REST” and “RPC” as suggested by the article: if sending over a structured response that has to be interpreted by a client program is considered RPC then why is sending over a structured response that has to be interpreted by the browser not RPC? REST as described by the article is by definition a subset of RPC - you invoke a remote procedure, you get a response. Besides, it stands to reason that the stateless properties of REST are much more interesting than the “returns a hypermedia response” but.<p>As to the rest (pun) of the article… I have no problem accepting that REST was originally proposed as a way to navigate the web using hypermedia responses. But I also have no problem in accepting that the term has since moved on to describe the API design principles which ultimately what makes it useful for the modern web.<p>Funnily enough, recent interest in SSR almost makes it a full circle.
labradoralmost 3 years ago
<i>There are only two hard things in Computer Science: cache invalidation and naming things</i> -- Phil Karlton<p>A new name is needed for Classic REST. The use of HATEOAS is ugly because it has HATE in the name. Hypermedia Constraint REST is better. Stateless REST. Pure REST. Classic REST. Separation of Concerns REST. Rest 1.0. Hypermedia REST vs JSON REST
评论 #32149565 未加载
andrewstuartalmost 3 years ago
The details of how computers talk to each other is, or really should be, largely irrelevant. It&#x27;s silly busywork all the little micromanagement of interfaces and data structures.<p>It&#x27;s plumbing.<p>Some time in the future there will be another level of the software revolution in which alot of those details can be left to the computers themselves to work out.
评论 #32144055 未加载
wruzaalmost 3 years ago
Answering the headline question: developers love buzzwords and sticking to ideas instead of doing jobs in a way that fits a situation.<p>What bugs me most in this is that ceremonial part. “Pass parameters in urlencoded form, except when GET, then put them into query string”. Wtf? We are clearly doing RPC, not a clerical work. Some APIs may look like documents, e.g. stock market personal order book looks like a collection of signed legal documents, but others do not, e.g. ticker stream, weather info, etc. Can we please stop stretching buzzwords and just settle on RPC, which could be abstracted away into `result = await resource.foo(bar, baz)` instead of processing numerous structured outcomes from network failures to operational errors which have no corresponding http status codes, unless you stretch to the one that sounds similar.
systematicalalmost 3 years ago
Talk about a getting lost in semantics rant. If you want to make your API &quot;RESTful&quot; like this person describes, there is JSON-LD. Most engineers are going to look at all the extra JSON as getting in their way. What was the point of this rant again?
评论 #32149044 未加载
Cthulhu_almost 3 years ago
The argument seems to be that modern-day REST is not self-descriptive, but... making it so is a lot of extra work for little benefits; people have optimized for efficiency and focus on what they need.<p>The links in a JSON response are only applicable if you need a client to be able to explore from the response on, but in practice it&#x27;s not necessary and you&#x27;re better off saving the response overhead.<p>A high over design like an OpenAPI spec is better in all the cases I&#x27;ve seen. And of course there&#x27;s alternatives like GraphQL or grpc depending on the use case. I&#x27;d still prefer REST for public APIs though.
ascendantlogicalmost 3 years ago
I once attempted to implement HATEOAS many years ago after one of our senior devs got a bug up their ass about it. It was a disaster. Our clients weren&#x27;t going to suddenly sprout new functionality to consume the discoverable endpoints if we changed the API, there were always going to be client-side changes to be made as well so it was an enormous exercise in futility. Ever since then HATEOAS has always felt to me like a way to design and implement APIs thought up in the ivory towers of academia, not by anyone on the ground, in the trenches at your everyday software company.
asiachickalmost 3 years ago
I hate when people change meanings too, but they do. What can you do about it? Complaining is like whining about all the words that have changed meanings over the decades.<p><a href="https:&#x2F;&#x2F;www.google.com&#x2F;search?q=top+words+that+have+changed+meaning" rel="nofollow">https:&#x2F;&#x2F;www.google.com&#x2F;search?q=top+words+that+have+changed+...</a><p>One I hate is &quot;rougelike&quot;. I doesn&#x27;t mean &quot;like the game Rouge&quot; (which might include Diablo and certainly includes Larn) Instead it now means any game with randomly generated levels but requires no other similarities to Rouge.
评论 #32147432 未加载
keyreachalmost 3 years ago
Have I understood idea of REST that described in the article right? I still have some documented &quot;route&quot; to resource, but instead of mapping it trivially to URL (as done in &quot;pseudo-REST&quot;), client requests entry point, then goes through labelled hyperlinks and forms according to &quot;route&quot; to reach resource.<p>It makes sense as it allows implementation of seamless API across multiple servers and removes need to make consistent URL structure. But won&#x27;t it add too much overhead then?
评论 #32156306 未加载
pjmlpalmost 3 years ago
Because REST as designed while it might be some academic ideal, doesn&#x27;t make sense in distributed computing performance point of view.<p>Needless network requests to understand what a REST API is supposed to be able to do, and then navigate through their description, until the actual call can be finally be done.<p>And then even if it isn&#x27;t pure REST, we have all those global warming contributions out of needless parsing.<p>Thankfully with the uptake of gRPC we are getting back to protocols where network performance is taken into consideration.
ess3almost 3 years ago
I feel like the biggest reason why REST failed is because it’s just not useful from a business point of view. Like how will I put my logo and brand colors over all of this.
irrationalalmost 3 years ago
I love this kind of article. I’ve been involved in web development since the mid-1990s, so I lived through all the things the author is talking about, but I never got down into the weeds and did things like read dissertations. Reading this article makes so many things make sense about where web development has gone and why. I could never quite put my finger on why I was so uncomfortable with where it had gone until now.
sytringy05almost 3 years ago
This article answers its own question: &quot;The situation is hopeless, but not serious.&quot;<p>REST vs HATEOS vs HTTP API vs Web Service<p>It&#x27;s not serious and it doesn&#x27;t matter that much. If I&#x27;m writing an API, I probably want to give people or systems access to my data and services. Missing links will be a mild inconvenience when compared to things like bad naming, inconsistent data structures, confusing error codes or domain complexity.
ivanjermakovalmost 3 years ago
Technology took a turn unexpected by the creator. Developers utilize REST not for &quot;REpresentaional&quot; part, but for the constraints it enforces: client-server, uniform interface, stateless and others[1]<p>[1]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Representational_state_transfer#Architectural_constraints" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Representational_state_transfe...</a>
jacobsenscottalmost 3 years ago
I do love json-html-rpc (rest) api&#x27;s that embed the &quot;next page&quot; and &quot;previous page&quot; links in their json. That is super useful.
jayd16almost 3 years ago
Here&#x27;s the crux of the argument but it falls flat IMO:<p>&gt;A proper hypermedia client that receives this response does not know what a bank account is, what a balance is, etc. It simply knows how to render a hypermedia, HTML.<p>No true client would know how to display json or not know how to display html. So if you have a browser plugin that pretty prints json, it&#x27;s RESTful? Seems pretty specious.
评论 #32148601 未加载
osigurdsonalmost 3 years ago
I love how our industry likes to use official sounding names like the &quot;Richardson Maturity Model&quot; and the &quot;Liskov Substitution Principle&quot;, etc, as if these informal ideas are on the same level as general relativity and quantum electrodynamics. Thanks Uncle Bob and Martin Fowler for your important contributions to science.
kieckerjanalmost 3 years ago
I did my last webdevelopment in the early noughties, so I have little skin in the game. My mental summary of this debate is that if you need your browser to be a universal turing machine instead of a renderer, you are probably not doing it the RESTful way. Whether that is a bad thing, is a matter of opinion.
coldteaalmost 3 years ago
It&#x27;s because nobody cares what it meant and what the original concept was, and they don&#x27;t have a use for it (the original concept).<p>People want and find useful what they do use in practice: the &quot;opposite of REST&quot; REST.<p>It&#x27;s just that purists and&#x2F;or Fielding overestimate the importance of the original REST.
smrtinsertalmost 3 years ago
I have no doubt the original vision of REST will eventually come to fruition. It will probably be &quot;discovered&quot; by some energetic entrepreneur in future and by used to incredible effect. I believe the rest of us are just going along with the flow and earning paychecks.
greenthrowalmost 3 years ago
We all decided to keep the important principles of REST and drop the HTML responses because HTML is a terrible format for data exchange between automated systems. JSON is much better for this because it has a simpler schema.<p>This post is very pedantic. Being pedantic is not helpful.
评论 #32144801 未加载
ahallockalmost 3 years ago
I think it was to distance these APIs from the complexities of SOAP. I think modern JSON-based APIs are somewhat RESTful--mostly in URL structure and using the basic HTTP verbs and response codes, but that&#x27;s where it basically ends.
Twisellalmost 3 years ago
And sometimes you end up with worst of both world:<p>The salesman say: the documentation is the API it&#x27;s RESTfull!!!!!!!!<p>The developer hear: Don&#x27;t care about user documentation it&#x27;s RESTfull!!!!!!!<p>The client get: A shitty documentation and a JSON API
dncornholioalmost 3 years ago
This guy.. I do whatever the fuck I want. Why does this person feels the need how to write my API and what I should call it?. This guy&#x27;s obviously living in a cocoon. Who even uses the term hypermedia?
gfodoralmost 3 years ago
See also: Hungarian notation (apps vs system)<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hungarian_notation" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hungarian_notation</a>
VincentEvansalmost 3 years ago
This reads exactly like someone going to great length eloquently bemoaning how racetracks are meant for horses and anything else is a travesty, and here’s a pedantic list of reasons as to why!
mirekrusinalmost 3 years ago
No mention of Ruby on Rails - they made REST mass popular with drawing resource routes, nesting, going out of their way on client side Ajax to support http verbs, error codes etc.
alasdair_almost 3 years ago
&gt;You can tap the sign as much as you want, that battle was lost a long time ago.<p>Hill in the battle that I intend to die on: &quot;crypto&quot; means &quot;cryptography&quot; dammit!
chazualmost 3 years ago
I want the author of htmx to get together with the guy from pandastrike and rant about the misuse of REST for an hour a week. It would be my new favorite podcast.
评论 #32147189 未加载
jrochkind1almost 3 years ago
This is undated, but I could swear I had read it before years ago! But I can&#x27;t find an earlier publication, I guess I read a similar thing!
评论 #32144241 未加载
pojzonalmost 3 years ago
Better question is how opl can write API like this and call it rest:<p>POST &#x2F;api&#x2F;findAllImagesMatchingMyPredicate<p>Body: jsonObject<p>And I work with those ppl. Time to look around..
datavirtuealmost 3 years ago
”REST must be the most broadly misused technical term in computer programming history.&quot;<p>I think OOP and REST are neck-and-neck on this one.
arein3almost 3 years ago
Interesting, but the cat is out of the bag.<p>Now REST means JSON (or other data format) over HTTP with respect to the HTTP methods
tdeckalmost 3 years ago
Beyond the HTML web, are there any practical examples of &quot;actual REST&quot; that we can look at?
lacrosse_tanninalmost 3 years ago
I need to make a SPA and it&#x27;s requisite backend. Which highfalutin theory of API should I use?
zemalmost 3 years ago
&quot;the situation is hopeless but not serious&quot; is a wonderful way to describe it.
dijitalmost 3 years ago
Responding to the topic: Similar to how Agile isn&#x27;t very Agile, I suspect.
estalmost 3 years ago
The best correct usage of REST is WebDAV and let it die in peace.
bilsbiealmost 3 years ago
You either die a hero or live long enough to become the villain.
wnevetsalmost 3 years ago
How did Agile come to mean the opposite of Agile?
评论 #32145681 未加载
dmtroyeralmost 3 years ago
sounds like we just need a new acronym, or can we just call it REST2 and move on?
a4ismsalmost 3 years ago
As an &quot;elder&quot; in our industry, I encounter &quot;old people arguments&quot; on a regular basis. A few observations that seem to apply here:<p>1. Naming things is hard. Sometimes a thing gets a name for a reason that made sense a long time ago, but things evolve, and the original name no longer makes sense.<p>This isn&#x27;t necessarily a problem. Nobody cares that we no longer typeset words and print images on paper, physically cut them out, and then physically paste them onto a board, which we take a picture of and use the picture to run the phototypesetter (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Phototypesetting" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Phototypesetting</a>).<p>Yes, I am old enough to have worked on hybrid publishing system that used laser printers to create text that was physically copied and pasted in the manner described above. No, I don&#x27;t argue that &quot;cut&quot; and &quot;paste&quot; are the wrong words to describe what happens in editing software.<p>So if we use the term &quot;REST&quot; today in a manner that doesn&#x27;t agree with how the coiner of the term meant it when discussing the architecture of a distributed hypermedia system... Sure, why not, that&#x27;s ok. We also don&#x27;t use terms like &quot;OOP&quot; or &quot;FP&quot; precisely the way the terms were used when they were first coined, and for that matter, we probably don&#x27;t all agree on exactly what they mean, but we agree enough that they&#x27;re useful terms.<p>What else matters? Well...<p>2. Sometimes arguing about what the words used to mean is a proxy for arguing about the fact that what we consider good design has changed, and some people feel it may not be for the better.<p>That&#x27;s always a valuable conversation to have. We sometimes do &quot;throw out the baby with the bathwater,&quot; and drop ideas that had merit. We footgun ourselves for a while, and then somebody rediscovers the old idea.<p>The original OOP term was about hiding internal state, yes, and about co-locating state with the operations upon that state, yes, but it was also about message-passing, and for a long time we practiced OOP with method calling and not message-passing, and sure enough, we had to rediscover that idea in Erlang and then Elixir.<p>Forget whether the things we do with JSON should or shouldn&#x27;t be called &quot;REST-ful&quot; because they aren&#x27;t the same was what the word was intended to describe way back when. Good questions to ask are, &quot;What did that original definition include that isn&#x27;t present now?&quot; &quot;Woudl our designs be better if we behaved more like that original definition?&quot; &quot;What problems did the original definition address?&quot; &quot;Do we still have those problems, and if so, are they unsolved by our current practices?&quot;<p>If there&#x27;s something good that we&#x27;ve dropped, maybe we will get a lot of value out of figuring out what it is. And if we want to bring it back, it probably won&#x27;t be by exactly replicating the original design, maybe we will develop entirely new ways to solve the old problems that match the technology we have today.<p>TL;DR<p>The question of whether an old term still applies or not can generate a lot of debate, but little of it is productive.<p>The question of whether an old design addressed problems that we no longer solve, but could solve if we recognized the problems and set about solving them with our current technology is always interesting.
jsiaajdsdaaalmost 3 years ago
Don&#x27;t care about the semantics or grammar-- I just need a way for the UI to run a function on a server.
revskillalmost 3 years ago
JSON actually means Representation State Transfer that the original author wanted, that&#x27;s what made JSON the same meaning as RESTful API !