4 ms·
Real REST is a very, very small minority. Fake REST (i.e., JSON RPC) is really ridiculously common.
by eadmund 2y ago
Real REST is a very, very small minority.
Fake REST (i.e., JSON RPC) is really ridiculously common.
- deleted 2y ago[deleted]
- mplanchard 2y agoI’ve never liked the no true scotsman nature of REST (which is exacerbated by the fact that its canonical “specification” is a broad PhD dissertation with a lot of other concepts thrown in), so I have adopted a fairly lax definition: if your URLs are subjects and you use HTTP verbs for the verbs, I feel like it qualifies.
- eadmund 2y agoLanguage is a means of communication, and we have to have some sort of agreement on terms. REST had an original meaning; that is a useful thing to be able to discuss. JSON-RPC is also a useful thing to discuss. But the two things are different. It’s confusing to use the one word or phrase to mean two different things (like ‘inflammable’!). Granted, language is to some extent defined by usage: if enough people use a term incorrectly, and few enough people use it correctly, then the incorrect usage becomes correct and the correct incorrect. Fine, we can use ‘REST’ to mean ‘RPC over HTTP with a JSON encoding.’ But could the advocates of that usage propose a term we can all use for what Fielding described in his thesis? Potrzebie? The thing that worries me, is if we start using ‘REST’ to mean JSON-RPC, and ‘Potrzebie’ to mean ‘the style formerly known as REST’: will people start using ‘Potrzebie’ to mean JSON-RPC? Perhaps worse, maybe they will start using it to mean ‘gRPC with JSON encoding.’ I propose that it’s best to use words and phrases for what they originally mean, for as long as one can, and to fight strenuously against changing them. Otherways wun May nyet wit was kood hap.
- mplanchard 2y agoREST’s original meaning is pretty ambiguous and poorly specified. The dissertation was written to describe the design and architecture of the HTTP protocol itself, which was largely designed with and alongside this concept of REST. It predates a lot of modern Internet usage and thus doesn’t map perfectly onto current paradigms. I’d argue that even saying a “REST API” means you’re already in the land of impurity. “True REST” is expounded upon by Fielding in a variety of places, and is essentially HATEOS (hypermedia as the engine of application state). But no one, and I mean no one, actually does that. Thus, in order to communicate effectively and “have an agreement on terms,” as you say, we need a less strict definition. I provided my suggestion. If your suggestion is to go back to the primary sources, I have. Multiple times. It does not provide a particularly concrete or useful definition (because its point was not to define REST). If it had, trying to define it would be much less of a no true scotsman game. Notice that we’re not sitting here debating the meaning of HTTP.
- kelseyfrog 2y agoIt is. One of the biggest points of tension is that we've more or less settled on JSON as an interchange format which is not exactly hypermedia put of the box. That contradiction has severe implications in the application of HATEOS as it exists re JSON APIs.
- physicles 2y agoMaybe I've been educated in a strange part of the internet, but I assume that this ship already sailed ~10 years ago: when most people (90%+) hear REST, they imagine something vaguely like JSON-RPC. (and this is how ChatGPT, a sort of average of all opinions on the Internet, understands it) So if you say REST and mean something other than that, then you're committing to being misunderstood by most people.
- deathanatos 2y ago> So if you say REST and mean something other than that, then you're committing to being misunderstood by most people. Perhaps, but TFA is clearly written in that it is using the actual, real meaning of REST, not the value-drift corruption the laity have wrought. (The upthread comment snips out the surrounding context that brings that clarity.) Which brings us right back to the problem at hand: Potrzebie.
- physicles 2y agoThis is true. And the comments are full of people confused about how the article is using the term REST.
- tshaddox 2y agoDoes Stripe's API qualify? It has URLs which are verbs, e.g. GET /v1/customers/search POST /v1/payouts/:id/cancel POST /v1/disputes/:id/close
- mplanchard 2y agoIMO, no, those endpoints don't qualify. That's just RPC over HTTP. Nothing wrong with it, but not REST (REpresentational State Transfer), since it's not transferring representations of state. Search is probably not worth shoehorning into a REST paradigm (don't be a purist!). The others are easy enough though, something like PATCH /v1/payouts/:id {state: canceled} PATCH /v1/disputes/:id {state: closed} Or an equivalent PUT with the whole object. Or if you want to be json-patch standards-compliant: PATCH /v1/payouts/:id {op: "replace", path: "/state", value: "closed"} FWIW this is why I think it's not really productive to be persnickety about a "REST API" being 100% always REST. A CRUD app is still a CRUD app if you do some occasional other operations, and a REST API can still be a REST API with some endpoints that are not REST.