News for hackers. Stuff that matters.
Re:How did REST come to mean the opposite of REST? by eterevsky on Tuesday July 19, 2022 @02:32AM (#32148225)
If you are designing a REST API, please don't follow this author's advice and return HTML instead of JSON. HTML takes much longer to parse and makes the API more fragile.

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.

What this article is about is a pedantic terminology battle of whether to call the current practice REST or not.

Re:How did REST come to mean the opposite of REST? by krainboltgreene on Tuesday July 19, 2022 @05:56AM (#32149472)
> If you are designing a REST API, please don't follow this author's advice and return HTML instead of JSON. HTML takes much longer to parse and makes the API more fragile.

you're describing what a browser does.

> has dropped the unnecessarily complicated bits.

you're viewing this content from a browser.

Re:How did REST come to mean the opposite of REST? by eterevsky on Tuesday July 19, 2022 @12:27PM (#32154101)
What's your point? If something works for the purposes of UI, it doesn't mean it is good for an API.
Re:How did REST come to mean the opposite of REST? by irrational on Tuesday July 19, 2022 @02:43AM (#32148270)
Don’t parse the HTML, just display it. That’s what the browser does best.
Re:How did REST come to mean the opposite of REST? by woodweb on Tuesday July 19, 2022 @10:24AM (#32151958)
What if a mobile application wants to use the API?
Re:How did REST come to mean the opposite of REST? by chasinglogic on Wednesday July 20, 2022 @01:29AM (#32161798)
This to me is the real question. I don't see how you could easily create multiple clients if you're practicing what is preached in the article.

You're really tying your server to the browser at that point so things like CLI clients and mobile clients become painful to write (not impossible but ain't nobody got time for parsing HTML when browsers do a perfectly good job of it, not to mention CSS.).

Re:How did REST come to mean the opposite of REST? by NoGravitas on Tuesday July 19, 2022 @02:17PM (#32155808)
REST systems are designed for use with "generic" clients. The generic client for REST systems on the WWW is a browser. There is probably one available for your mobile platform.
Re:How did REST come to mean the opposite of REST? by firstbabylonian on Monday August 01, 2022 @06:06AM (#32303911)
What if a native application (mobile or desktop) wants to consume the API?
Re:How did REST come to mean the opposite of REST? by woojoo666 on Tuesday July 19, 2022 @07:28AM (#32150075)
Not the parent commenter, but I believe the idea is that if the webpage uses a framework like React or Angular, then the server doesn't need to send html, it can just send the bare minimum data necessary (in JSON) and the client turns it into html and displays it.

In other words, HTML is just the standard format that the browser uses. But if you use frameworks or define your own application specific formats, you can send less information over the wire and have it properly decoded and displayed by your client-side javascript.

Re:How did REST come to mean the opposite of REST? by z9znz on Tuesday July 19, 2022 @03:42AM (#32148627)
This article really is about getting people to use their overloaded HTML libraries.