News for hackers. Stuff that matters.
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.