News for hackers. Stuff that matters.
Re:How did REST come to mean the opposite of REST? by kelseyfrog on Monday July 18, 2022 @05:20PM (#32143928)
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 rewards of calling an API RESTful despite the accuracy of the statement.

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'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.

Re:How did REST come to mean the opposite of REST? by trixie_ on Monday July 18, 2022 @05:24PM (#32143993)
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.

Re:How did REST come to mean the opposite of REST? by kelseyfrog on Tuesday July 19, 2022 @12:09PM (#32153776)
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? by fennecfoxen on Monday July 18, 2022 @05:27PM (#32144041)
I tend to find it helpful to ask, "is this proper REST as in HATEOAS, or is just 'REST-ish'?" It's usually just REST-ish: predefined URL patterns, roughly 1:1 with specific resource-APIs; they care about your HTTP verb and return JSON (but usually not with a lot of URLs in that JSON).
Re:How did REST come to mean the opposite of REST? by kelseyfrog on Monday July 18, 2022 @05:45PM (#32144308)
It's funny because HATEOAS violations were single-handedly the most common violation made by the client team during my time there. They loved hard coding URLs and willfully ignoring hypermedia.
Re:How did REST come to mean the opposite of REST? by sanderjd on Monday July 18, 2022 @10:15PM (#32146751)
See, to me, this sounds like a failure to listen to your customer. They were telling you that well known URLs were useful to them, and you were forcing them to make more compromises so that you could make fewer.
Re:How did REST come to mean the opposite of REST? by kelseyfrog on Tuesday July 19, 2022 @01:07AM (#32147750)
We answered to the architecture team on matters of design. If the client team had had beef with the design, the client team took it up with them.
Re:How did REST come to mean the opposite of REST? by quickthrower2 on Monday July 18, 2022 @11:44PM (#32147308)
What do they do if they don’t hard code it?

   bookHotelUri = listHotelResponse.data.urls[4];
Or

    listHotelResponse .data.urls.find(u=>u.action===‘book’).url

?
Re:How did REST come to mean the opposite of REST? by kelseyfrog on Tuesday July 19, 2022 @11:21AM (#32152805)

    listHotelResponse.data.urls.find(u=>u.rel===‘booking’).url
Web linking is defined in https://www.rfc-editor.org/rfc/rfc8288.html and that's the basis for using rel as well as a host of other attributes.
Re:How did REST come to mean the opposite of REST? by kelseyfrog on Tuesday July 19, 2022 @01:03AM (#32147726)
Sort of. Verbs are still eschewed so rather than finding a 'book' link, it would be a 'booking' link to which a POST could be made to create a new booking. As a note, "Booking" is a confusing example because while a hotel booking is a noun it at first glance reads as a progressive tense verb.
Re:How did REST come to mean the opposite of REST? by jasonboyd on Tuesday July 19, 2022 @02:33AM (#32148238)
So instead of a hard coded url it's a hard coded reference to a url? How does it deal with a breaking changing? Say the order of the links changes? It doesn't seem like this works without some out of band information.
Re:How did REST come to mean the opposite of REST? by kelseyfrog on Tuesday July 19, 2022 @10:22AM (#32151908)
They are keyed using rels. You're right, they aren't relying on order; that would be terrible. And yes, JSON doesn't "have" rels. This is worked around by specifying a mimetype which does. Is it turtles all the way down? Yes, but not all turtles are equivalent. You should already be specifying a "Content-Type": application/json, it's not too much to change that to application/vnd.api+json and write a spec somewhere.
Re:How did REST come to mean the opposite of REST? by sanderjd on Monday July 18, 2022 @10:12PM (#32146733)
Counterpoint: This all got a lot worse and more confusing for me when I read the dissertation. What people seemed to call RESTful struck me as a bit convoluted but fine and workable. But after I read the dissertation, it was clear that all that was "wrong", but I was left without any real concept of what was both right and workable. It took me years to realize I could just ignore the whole thing and focus on designing useful interfaces. (And that, indeed, this is what most people had been doing already.)
Re:How did REST come to mean the opposite of REST? by wink on Tuesday July 19, 2022 @06:28AM (#32149664)
I think you're missing a little historical context here, but maybe you were already more experienced back then than I was, for example (which means your bubble was in the know and the unwashed masses weren't). I started making websites in 1998 and earning money with it in 2001ish (that's the year Wikipedia launched) and imho back then it was a lot harder to find the 'correct' way with teaching yourself. I saw REST/RESTful and best practices for the web mostly develop after 2005-2008 (yeah, around the time there was the great Rails exodus as well) and people started to standardize more. What I'm trying to say is that it was all more the Wild West in web development and by the time people had more insight, the naming/switch to JSON had already begun. I also don't remember when I read the REST dissertation first, probably only much later than 2001.
Re:How did REST come to mean the opposite of REST? by kelseyfrog on Tuesday July 19, 2022 @12:23PM (#32154027)
That aligns roughly with my experience. What I mean is that even post 2010 most people haven't read the material and continue to promote weird frankenapis which they call RESTful based on scrap anecdotes or secondhand messageboard info, or hermeneutical readings of other API designs.