Re:Show HN: Deck of Cards – A playing card API
by hartror on Monday May 11, 2015 @12:35AM
(#9522727)
I assume you mean what is the benefit of hypermedia?
Martin Fowler does a good job explaining it (http://martinfowler.com/articles/richardsonMaturityModel.htm...).
As does Mike Amundsen (http://www.infoq.com/presentations/Building-Hypermedia-API).
Re:Show HN: Deck of Cards – A playing card API
by iamflimflam1 on Monday May 11, 2015 @04:06AM
(#9523299)
I don't see much benefit in martin fowler's example
<openSlotList>
<slot id = "1234" doctor = "mjones" start = "1400" end = "1450">
<link rel = "/linkrels/slot/book" uri = "/slots/1234"/>
</slot>
<slot id = "5678" doctor = "mjones" start = "1600" end = "1650">
<link rel = "/linkrels/slot/book" uri = "/slots/5678"/>
</slot>
</openSlotList>
Each slot now has a link element which contains a URI to tell us how to book an appointment.
Well, not really - we can only guess that by the fact that the link ends in "book".We also don't know if we are supposed to GET, PUT, DELETE, POST.. or what data we are supposed to send to the url to actually make the booking.
Re:Show HN: Deck of Cards – A playing card API
by evanspa on Monday May 11, 2015 @10:03AM
(#9524772)
Clients of a hypermedia REST API are supposed to have a priori knowledge of the link relations (the "rel" attribute). The fact the rel in this example looks like a URI is sometimes used as a convention (i.e., if the API supports it, a client may do a GET against the rel value, and get back a human-readable description of the purpose of the rel).
In the human readable description of the "/linksrels/slot/book" link relation, information should be given about what generally can be done with such links (like if GET or POST is supported, etc). This allows you to build your client applications. The value of the actual link (the 'uri' attribute) should be completely opaque to the client.
Other than learning, what's the benefit here?