Hacker News new | ask | show | jobs
by recursivedoubts 909 days ago
OK OK OK, OK OK, stay calm, Carson, stay calm...

I'd like to just leave a few links on REST here for the reader's consideration:

https://htmx.org/essays/how-did-rest-come-to-mean-the-opposi...

https://intercoolerjs.org/2016/01/18/rescuing-rest.html

https://htmx.org/essays/two-approaches-to-decoupling/

https://htmx.org/essays/hypermedia-apis-vs-data-apis/

https://htmx.org/essays/hypermedia-clients/

https://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.h...

https://htmx.org/essays/hateoas/

In addition, I’d just like to interject for a moment. What you’re referring to as REST, is in fact, JSON/RPC, or as I’ve recently taken to calling it, REST-less. JSON is not a hypermedia unto itself, but rather a plain data format made useful by out of band information as defined by swagger documentation or similar.

Many computer users work with a canonical version of REST every day, without realizing it. Through a peculiar turn of events, the version of REST which is widely used today is often called “The Web”, and many of its users are not aware that it is basically the REST-ful architecture, defined by Roy Fielding.

There really is a REST, and these people are using it, but it is just a part of The Web they use. REST is the network architecture: hypermedia encodes the state of resources for hypermedia clients. JSON is an essential part of Single Page Applications, but useless by itself; it can only function in the context of a complete API specification. JSON is normally used in combination with SPA libraries: the whole system is basically RPC with JSON added, or JSON/RPC. All these so-called “REST-ful” APIs are really JSON/RPC.

4 comments

> All these so-called “REST-ful” APIs are really JSON/RPC.

The situation is even worse than that because JSON-RPC is well specified:

https://www.jsonrpc.org/specification

These so-called "REST-ful" APIs are often ad hoc RPC, underspecified in many respects, and make a twisted mess of HTTP semantics and request/response payloads; and when an edge case or shortcoming is discovered, the API sprouts more wild hairs.

What's even more "fun" is when you look through the project's history and discover that at some point, someone/s on the team fixed the problem by introducing proper JSON-RPC (per spec). Maybe they even got pretty far along with cleaning up most/all of the API. But then they moved on or got pushed aside. Other devs didn't like the JSON-RPC system ("too verbose", "too much effort to refactor/whatever") and started sprouting new "REST-ful" endpoints so they can, you know, get things done faster!

Thank you! Exactly my thoughts. I stopped using the term REST because in web development circles it’s meaningless. I use Hypermedia API.
This is fair, what I think ended up happening in the 2010s is that REST was pushed similar to XML, a solution for all application problems (it wasn’t like Fielding was not pushing this view either), and realistically the useful scope of REST and Hypermedia is quite limited.
I see what you did there