Live data from Hacker News

How did REST come to mean the opposite of REST?

htmx.org

331–340 of 393 posts

Re: How did REST come to mean the opposite of REST?

#331
post #254

Earlier quoted context omitted.

If you serve static content with nginx or any other webserver, you'll get 404 for any file that doesn't exist. Why should '${my_widget} not found' be different?

The Webserver Servers a file or an endpoint. This file or endpoint have indeed be found. On this layer the transaction was successful. So if you return 404 on this layer you are saying that whatever file or endpoint you searched is not there. If you ask for a resource at an endpoint that does not exist e.g. via an parameter in the url and return 404 it is not clear if the endpoint does not exist e.g. the endpoint.php…

You're talking about implementation details on thw server side. Why should the client care about that?

Why should the error code for /product/foo/thumbnails/123.jpg be different if served with nginx serving a static file or an application server that dynamically generates it based on the product id?

Re: How did REST come to mean the opposite of REST?

#332
post #85

Earlier quoted context omitted.

I found that json-ld, json-hal and other "describe your json" standards were needed to make json human readable-ish. I hate that there are many competing standards and the link syntax feels clumsy. JSON5 for "add comments, allow ES6 features" was perfect for private and in a small team use for a while. No one seems to listen to the JSON inventor, who said he regrets creating a misnomer name and no successor should us…

JSON is syntactically valid JavaScript, why do you say it's not compatible with JavaScript?

Ask Douglas Crockford. I did not find my source on his apprehension of his name.

What id did find: He states that he did plan for JSON to be a JavaScript subset, which contradicts his later finding, for which I have only me memory as a source, that JSON is not in some sense JavaScript.

More on topic, I did find a source that it was never meant to be human-readable in the sense of usable for documentation, but a machine-communication language, therefore comments were removed from the initial draft to avoid having non-standard meanings put in the freedom comments allow (think pre-process directives etc.).

Re: How did REST come to mean the opposite of REST?

#333
post #175
post #70

Earlier quoted context omitted.

By my read of this "REST API" is a near oxymoron. It was never supposed to be an "API" in the sense that a program consumes it. It was originally described as "Representational State Transfer (REST) architectural style for distributed hypermedia systems" with a focus on describing resources in generic ways for consumption by hypermedia systems (not arbitrary programs!). I think this is most clearly described by two t…

> describing resources in generic ways the trouble is that HTML is anything but generic. If you've ever tried to write a web scraper that can be used on _any_ webapage you quickly discover that its near impossible. I use to belived that there should be one way to use HTML to describe the page content and the rest should be CSS but gave up as its completely inflexable and the approch has been abandoned for simply desc…

Similarly a client that just "does" HATEOAS and could be usefully used on any API is pretty much unattainable. At best you're going to be operating like a crawler.

Knowing what to actually do and what's useful and what the resources and their components actually mean, that's all out-of-band, much like knowing the structure of a site you want to scrape.

Re: How did REST come to mean the opposite of REST?

#334

Earlier quoted context omitted.

I’m not sure what the infatuation with HTTP verbs is. RPC allows modeling objects and arbitrary verbs. REST gives you a handful of verbs and punts on data modeling. It always seemed like a step back from an API design perspective. Definitely a battle I lost but never really understood the other side to begin with.

Yes, people who use put and delete (and any other verb other than post and get) come off as insufferable bores to me. Heck, you just use GET and it will work fine 99% of the time.

"GET" should not be used for anything that changes state (beyond simple logging of requests).

I'm an AppSec engineer and if I were doing a penetration test and found that an endpoint was using GET requests for state changes, I'd consider it a serious enough bug to put it on the report, even if it wasn't a security issue.

Re: How did REST come to mean the opposite of REST?

#335
post #56

Earlier quoted context omitted.

This. I read quite much about REST and HATEOAS, and it didn't made any sense to me. Somehow the "magic sauce" was missing. How should a client that doesn't know anything about an API interpret it's meaning? I felt like an idiot. Like there was some high end algorithm or architecture that completely eluded me. But it the end, it probably just meant, HATEOAS is for humans.

I feel almost like there’s an implicit dependency on GAI for interpreting HATEOS properly .

Yes.

I thought so too!

I just had the impression, that this was too much and I'm simply missing something obvious.

Re: How did REST come to mean the opposite of REST?

#336
post #215

Earlier quoted context omitted.

Roy's suggestion in that comment thread is that it hasn't caught on because applying it takes more effort than people are willing to apply in most cases, in order to get benefits they don't care about, such as an architecture that can endure for decades (rather than, say, their OKRs for this quarter). I don't know if that's true, but it could be. It's also possible he's wrong about its benefits, or more precisely tha…

I see how one can argue that's why Haskell hasn't caught on, with the same line of reasoning. So I feel very comfortable dismissing it.

I think that's a productive analogy that can be read in many different ways!

For example, you could argue that Haskell makes tradeoffs to provide benefits that most developers don't care about most of the time, such as code terse enough to include in papers with a page count limit; and that this is a valid reason for people to prefer languages that prioritize other things, which is why Haskell hasn't caught on (thus the Haskell motto "avoid success at all costs").

Or you could read it as a clueless argument ascribing disadvantages to Haskell that it in fact does not have. This would be more difficult if the person making the argument were Simon Peyton Jones, since he presumably isn't mistaken about Haskell as such, but he might still have erroneous beliefs about the world that affect Haskell's use in practice.

To take the discussion up a level, Rogers's factors in the diffusion of innovations are (perceived) "relative advantage", "compatibility", "complexity", "trialability, "reinvention potential", and "observed effects". If we accept this model, the failed diffusion of an innovation such as REST or Haskell doesn't necessarily imply that it has little relative advantage, or even little perceived relative advantage; it might be that they're incompatible with other established practices, are difficult to learn ("complex"), require heavy up-front commitment ("trialability"), hard to repurpose for unintended uses ("reinvention"), or hard to observe the use of.

In fact, the diffusion literature consists almost entirely of research on diffusing innovations that had great difficulty diffusing despite having dramatic relative advantages, at least according to the authors.

That still doesn't mean we should comfortably dismiss assertions that one or another innovation doesn't actually confer a relative advantage.

Re: How did REST come to mean the opposite of REST?

#337

Earlier quoted context omitted.

hyperview is a hypermedia that exposes native mobile features directly within the hypermedia you wouldn't create an internet out of hyperview-apps, rather it is a way for you, a developer of a mobile application, to get the benefits of a hypermedia approach (e.g. versioning becoming much less of an issue, vs. app-store updates) while not giving up on native mobile behavior it is open source, and I think it's one of t…

It's an app builder not a hypermedia client. It's a pretty slight semantic difference but when we're talking about REST APIs for 3rd party clients then hyperview isn't really relevant to the discussion.

I don't see how you can say it isn't a hypermedia client: it is a client that interprets hypermedia, just like the canonical hypermedia client, a web browser.

It's not an internet hypermedia client like a browser, with general access to a broad network of different sites/applications, but the core mechanic satisfies REST and the format being transferred is a hypermedia.

Re: How did REST come to mean the opposite of REST?

#338
post #72

An earnest answer? Because few people have taken the couple hours(?) and read Roy Fielding's dissertation from start to finish. The biggest likely reason for not doing so is that frankly a bunch of people simply don't care, and why should they. There'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 re…

The dissertation is neither a specification or a standard which has led to decades long bickering of what 'REST' really is. Edit: See how this post has zoomed to hundreds of comments in just minutes by people arguing the 'one true REST'. The situation is insufferable.

For sure. It's not even focused on APIs. REST is an architectural style. I don't think I've ever heard the term RESTful architecture in design meetings or online discourse. That should say that something is off.

Re: How did REST come to mean the opposite of REST?

#339

Earlier quoted context omitted.

> I disagree that it isn't an API, but that's a definition quibble. I don't understand: An API is an application programming interface, i.e. it is meant to be consumed by other programs. How does that go together with > REST and HATEOAS are for humans ? And how does that go together with the requirements of "no interpretation needed" and therefore "little coupling" between client and server that were mentioned in the…

A concrete action I would suggest is splitting your data API out from your hypermedia API: https://htmx.org/essays/hypermedia-apis-vs-data-apis/ Use hypermedia (and, who would have guessed I'd recommend this? something like htmx) to build your web application. Use GraphQL or whatever other nonRESTful technology fits best to build your data API.

Isn't this just server-side rendering, just doing sections of the page rather than the full page?

Looks like it's encouraging coming almost full circle back to web 1.0 where all HTML was generated by the server.

Re: How did REST come to mean the opposite of REST?

#340
post #249

Earlier quoted context omitted.

Standardization and a common language. Limits. Well developed error codes. Rpc is a huge footgun. What's annoying about rest is that it is a religion treated as a universal truth. But really, rest is basically crud.

I disagree about well-developed error codes. Examples: * There is no useful distinction between different kindes of bad requests (syntactically wrong, structurally wrong, not applicable to the data found, etc.) * Special handling is needed to test if a resource exists -- you cannot just GET it and check for a 404 code because browsers log all 404 as errors, even if it's the "happy path" * The error codes confuse auth…

> There is no useful distinction between different kindes of bad requests (syntactically wrong, structurally wrong, not applicable to the data found, etc.)

That's false. The distinction is cromulently expressed by obeying the relevant RFC 9110 § 15.5.1. and 15.5.21. Further detail can be described as shown in RFC 7807 § 4.

> The error codes confuse authentication and authorization

It's not only the status codes. Like the misspelling of "referrer", this is legacy crap that cannot be changed to due backward compatibility.

> Special handling is needed to test if a resource exists -- you cannot just GET it and check for a 404 code because browsers log all 404 as errors, even if it's the "happy path"

That's analogue to "the whole world's a VAX" chestnut. Does existence of RFC ignorant software mean that we must penalise the other software that implements correctly? I think that would be a bad affair to be in. I refuse to make myself complicit in this.

> RPC is underrated because there have been horrible RPC monstrosities in the past

That's a misunderstanding of the argument in TFA. RPC on the Web is bad because the design is fundamentally worse, not a particular implementation.

Post reply on HN