Web-API Sample with 2 Entities & Hypermedia? Please - Still Looking.http://forums.asp.net/t/1789284.aspx/1?Web+API+Sample+with+2+Entities+Hypermedia+Please+Still+Looking+Mon, 09 Apr 2012 16:38:57 -040017892844916578http://forums.asp.net/p/1789284/4916578.aspx/1?Web+API+Sample+with+2+Entities+Hypermedia+Please+Still+Looking+Web-API Sample with 2 Entities & Hypermedia? Please - Still Looking. <p>Hi,</p> <p>Has anyone created a sample that has a couple entities that have a rel from one to the other and exposed through web-api? &nbsp;The single class example gets the general idea across, but when you start talking about navigating from, for example, a Customer class to an Orders class it quickly becomes more complicated. An example with something like this and how the client can get this data would be so beneficial. I know that I've talked with others who have voiced confusion over just how some of this works. Then you toss in the OData query string stuff and it gets even more convoluted. I haven't seen any guidance on this - maybe I've missed it.</p> <p>thanks!</p> <p>Bill44077</p> 2012-04-04T19:02:51-04:004916618http://forums.asp.net/p/1789284/4916618.aspx/1?Re+Web+API+Sample+with+2+Entities+Hypermedia+Please+Still+Looking+Re: Web-API Sample with 2 Entities & Hypermedia? Please - Still Looking. <p>This isn't a direct answer, but <a href="http://codebetter.com/glennblock/2012/01/08/hypermedia-and-web-api-design-brain-dump-and-samples/"> Glenn Block's post</a> is what most people are referring to when this question comes up.</p> <p></p> 2012-04-04T19:32:47-04:004916630http://forums.asp.net/p/1789284/4916630.aspx/1?Re+Web+API+Sample+with+2+Entities+Hypermedia+Please+Still+Looking+Re: Web-API Sample with 2 Entities & Hypermedia? Please - Still Looking. <p>You can consider&nbsp;<a href="http://www.asp.net/single-page-application/spa-samples/sample-bigshelf-application/big-shelf-architecture">http://www.asp.net/single-page-application/spa-samples/sample-bigshelf-application/big-shelf-architecture</a></p> <p>It uses much more entities. Operations should be as simple, as atomic as possible. I can recommend to review Repository pattern. Also good example of such approach can be Zoho API, or MailChimp api.</p> <p>Hope this helps!</p> 2012-04-04T19:45:35-04:004916725http://forums.asp.net/p/1789284/4916725.aspx/1?Re+Web+API+Sample+with+2+Entities+Hypermedia+Please+Still+Looking+Re: Web-API Sample with 2 Entities & Hypermedia? Please - Still Looking. <p>Hi,</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>bill44077</h4> Has anyone created a sample that has a couple entities that have a rel from one to the other and exposed through web-api? &nbsp;The single class example gets the general idea across, but when you start talking about navigating from, for example, a Customer class to an Orders class it quickly becomes more complicated. An example with something like this and how the client can get this data would be so beneficial. I know that I've talked with others who have voiced confusion over just how some of this works. Then you toss in the OData query string stuff and it gets even more convoluted. I haven't seen any guidance on this - maybe I've missed it.</blockquote> <p></p> <p>At the moment I am not aware of anyone with a solid example of Web API that implements what are known as Hypermedia Controls. However an example of what a response may look like is as follows:</p> <pre class="prettyprint">&lt;customer&gt; &lt;id&gt;122&lt;/id&gt; &lt;name&gt;Jim Walker&lt;/name&gt; &lt;link rel=&quot;self&quot; uri=&quot;http://api.example.com/v1/customer/112&quot;/&gt; &lt;orders&gt; &lt;order&gt; &lt;id&gt;92992&lt;/id&gt; &lt;cost&gt;243.19&lt;/cost&gt; &lt;product&gt;Custom A&lt;/product&gt; &lt;link rel=&quot;self&quot; uri=&quot;http://api.example.com/v2/order/92992&quot;/&gt; &lt;/order&gt; &lt;order&gt; &lt;id&gt;92998&lt;/id&gt; &lt;cost&gt;401.00&lt;/cost&gt; &lt;product&gt;Custom B&lt;/product&gt; &lt;link rel=&quot;self&quot; uri=&quot;http://api.example.com/v2/order/92998&quot;/&gt; &lt;/order&gt; &lt;/orders&gt; &lt;/customer&gt;</pre> <p>(In this case product was simply a name, not another entity in the system.)</p> <p>To get a great overview of RESTful applications give this InfoQ article a read:&nbsp;<a href="http://www.infoq.com/articles/webber-rest-workflow">http://www.infoq.com/articles/webber-rest-workflow</a></p> <p><a href="http://www.infoq.com/articles/webber-rest-workflow"></a>If you have any questions please feel free to ask or message me directly.<br> <br> </p> 2012-04-04T21:01:14-04:004916773http://forums.asp.net/p/1789284/4916773.aspx/1?Re+Web+API+Sample+with+2+Entities+Hypermedia+Please+Still+Looking+Re: Web-API Sample with 2 Entities & Hypermedia? Please - Still Looking. <p>Thanks Brock - Glenn always has some great insights to share. Thanks for the link!</p> 2012-04-04T21:37:15-04:004916776http://forums.asp.net/p/1789284/4916776.aspx/1?Re+Web+API+Sample+with+2+Entities+Hypermedia+Please+Still+Looking+Re: Web-API Sample with 2 Entities & Hypermedia? Please - Still Looking. <p>Thanks Alexey,</p> <p>I'll take a look at this sample. Yes, the repository pattern is really appropriate and we see it in all the samples - even the simple ones. I'll also check out Zoho API and MailChip api. Hopefully they're using asp.net web-api. :)</p> 2012-04-04T21:40:31-04:004916779http://forums.asp.net/p/1789284/4916779.aspx/1?Re+Web+API+Sample+with+2+Entities+Hypermedia+Please+Still+Looking+Re: Web-API Sample with 2 Entities & Hypermedia? Please - Still Looking. <p>Thanks Datawalke,</p> <p>The example makes sense. It's funny, the InfoQ article I can remember reading (years ago :) but still a great reference. I'm still hoping that I can come across an ASP.NET Web-API sample.</p> <p>regards,</p> <p>Bill44077</p> 2012-04-04T21:44:01-04:004923385http://forums.asp.net/p/1789284/4923385.aspx/1?Re+Web+API+Sample+with+2+Entities+Hypermedia+Please+Still+Looking+Re: Web-API Sample with 2 Entities & Hypermedia? Please - Still Looking. <p>Hi,</p> <p>Had an interesting discussion over the weekend with Glenn Block, Darrel Miller, Scott Hanselman, Kelly Sommers, Bill Simser and some others about the importance of Hypermedia in a Rest-ful api and we all agreed on it's significance. RestBugs was a demo application that came up as a good example for reference&nbsp;<a href="https://github.com/howarddierking/RestBugs">https://github.com/howarddierking/RestBugs</a>. Based on this app, I am closing this topic. Please let me know what you think of this as an example.</p> <p>thanks,</p> <p>Bill44077</p> 2012-04-09T16:38:57-04:00