rest - Hypermedia API Link Traversal & Practicality -


i've been trying build hypermedia based api. things seem working well. when fetch /books/isbn/12313441213 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 can traverse authors resource. when fetch /books/by/author/id/18 this:

<books>   <book id="123">     <name>hypermedia apis</name>     <link rel="self" uri="/books/id/123" />   </book>   <book id="191">     <name>chef recipes 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 seems working fine me. whether or not way of uri templating good, question around how practical traverse links this?

considering want resource in full-depth (including author details), have make @ least 3 calls server. again collection, have make tons of calls server. yes maybe utilize resource expansion here, why use hypermedia links @ since of clients using expanded resources in time.

i understand gaining lots letting clients traverse links (ie. if clients build relation based resource discovery, impacted minimum when change api, or forced recent schema resource endpoint itself, etc). again, practicality of approach, or performance of approach kill system.

either i'm not getting in hypermedia api design, or hypermedia api sounds great seems it's theoretical idea, not practical one.

any thoughts on this?

this great question of time. in fact, big question is: knows traversal rels reach particular resource r?

for example reach "book-detail" resource client have make call entry of api eg "/" using rel "book-categories" uri book-categories make call options see if operation possible on resource book categories, rel "books-in-category" resource ...etc goes "book-detail" resource. traversal path resource r should part of knowledge of client. don't hard-code urls, read urls @ run time. considering machine-to-human scenario. inefficiency still there. in case of machine-to-machine scenario, automaton starts "/" can go through api , processing resources. if automaton has reach resources in tree (or may state machine) there no inefficiency. if automaton needs make call resource down in tree, , knows entry point of api run in issue of making several calls reach it's point.

many people tell introduce caching using etags and/or memcached, caching augment performance, cannot depend on caches 100% because caches stale, in cases code traversing resources r1 rn should in client.

check question on: https://stackoverflow.com/questions/15214526/why-hypermedia-api

but answer question on practicality: if have business work flow in client required go resource r1 r2 ... rn , want enforce flow, hypermedia practical. i'm assuming there no direct calls resource rx out going through r1 -> r2 ->... rx-1.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -