I am trying to create a hypermedia API. Everything looks good. Say when I get /books/isbn/12313441213 , I get something like this:
<book> <id>123</id> <name>Hypermedia APIs</name> <description>Basic api design techniques</description> <tags> <tag>rest</tag> <tag>api</tag> <tag>service</tag> </tags> <authors> <link rel="author" uri="/authors/id/22" /> <link rel="author" uri="/authors/id/18" /> </authors> </book>
Now I can get around the authors from this resource. When I get /books/by/author/id/18 , I get something like this:
<books> <book id="123"> <name>Hypermedia APIs</name> <link rel="self" uri="/books/id/123" /> </book> <book id="191"> <name>Chef Recipes for Rails Developers</name> <link rel="self" uri="/books/id/191" /> </book> <book id="220"> <name>Rails 4 Cookbook</name> <link rel="self" uri="/books/id/220" /> </book> <book id="292"> <name>Ruby 102</name> <link rel="self" uri="/books/id/292" /> </book> <book id="432"> <name>Semantic Architecture</name> <link rel="self" uri="/books/id/432" /> </book> <book id="501"> <name>Service Oriented Design</name> <link rel="self" uri="/books/id/501" /> </book> </books>
Which also seems to work just fine for me. Is this method of uri patterns good or not, my question is how practical is it to go through such links?
Given that you want the resource to be in full depth (including information about the author), you must make at least 3 calls to the server. Again, to collect, you have to make tons of calls to the server. Yes, maybe I could use the resource extension here, but why should I use hypermedia links in general, since all my clients will use the extended resources on time.
I understand that we are collecting lots, allowing clients to navigate links (i.e. if customers build relationships based on discovery resources, they will affect the minimum when the api changes, or they are forced to get the latest scheme from the resource of the endpoint itself etc.). Again, the practicality of this approach or the implementation of this approach will kill the system.
Either I'm not getting something in hypermedia api design, or hypermedia api sounds great, but it seems like it's just a theoretical idea, not a practical one.
Any thoughts on this?