-
Notifications
You must be signed in to change notification settings - Fork 43
csharp_short_samples
Bruno Oliveira edited this page Feb 8, 2011
·
1 revision
A Restful application should support hypermedia content, and following this constraint, a typical resource representing an order to take part in some trainings could be:
<order>
<product>rails training</product>
<price>512.45</price>
<atom:link rel="refresh" href="http://www.caelum.com.br/orders/1" xmlns:atom="http://www.w3.org/2005/Atom"/>
<atom:link rel="update" href="http://www.caelum.com.br/orders/1" xmlns:atom="http://www.w3.org/2005/Atom"/>
<atom:link rel="pay" href="http://www.caelum.com.br/orders/1/payment" xmlns:atom="http://www.w3.org/2005/Atom"/>
<atom:link rel="destroy" href="http://www.caelum.com.br/orders/1" xmlns:atom="http://www.w3.org/2005/Atom"/>
</order>
This documentation will guide you on how to create a simple REST client using Restfulie.
If you use Restfulie to access such a resource, there will be one entry point and all it's interactions will be driven by hypermedia links:
//retrieves the resource through GET: the entry point dynamic order = Restfulie.At(resourceURI).Get(); Console.WriteLine("the order price is " + order.Price); Console.WriteLine("The order product is" + order.Product); // Executing a state transition: order.Pay(); // sends a delete request order.Cancel()
We will use the Restfulie's ordering example application in Rails as a server. Its source code is open and can be found at github, and a live version can be found at heroku.