# REST Design

**URL:** <https://www.ruby-forum.com/t/rest-design/105328>\
**Category:** Rails\
**Created:** [May 28, 2007, 9:56pm UTC](https://www.ruby-forum.com/t/rest-design/105328 "2007-05-28T21:56:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/13edae/32.png) [@Lza](https://www.ruby-forum.com/u/Lza)\
**Post date:** [May 28, 2007, 9:56pm UTC](https://www.ruby-forum.com/t/rest-design/105328/1 "2007-05-28T21:56:10Z")

</div>

I am trying to design an application using a REST style, however, I am  
unsure of the correct way to handle a page which has multiple  
resources being displayed, such as hotel rooms and advertisements; or  
a page that displays the most recent items from a collection and also  
the least recent. Does anyone have any idea how I would go about doing  
this, or any suggestions of where I can go to find more information on  
this particular issue?

Thanks.

---

<div class="post-metadata">

**Author:** ![Lza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/13edae/32.png) [@Lza](https://www.ruby-forum.com/u/Lza)\
**Post date:** [May 28, 2007, 11:28pm UTC](https://www.ruby-forum.com/t/rest-design/105328/2 "2007-05-28T23:28:20Z")

</div>

There are many opinions I am sure. I would say that REST is more  
about information than presentation. More about services to be put  
together than monolithic web pages.

Using that perspective a web page that wants to present several  
resources should access the resources individually as separate  
components. Rails has not gotten to the point where this is well  
supported however. There is some support in edge for nested  
resources, but the last I heard it was not yet stable. Using that  
model you would have resources for the composite view and for each  
component resources.

But, basically unless you are presenting very simple information  
presentations REST is less about the browser and more about  
information access by other programs. So while your web page may be  
at /summary/something you may make each piece available separately as  
well. /rooms /advertisements /items/recent and /items/old or  
whatever.

What REST does advocate is that there are a limited number of  
operations GET, PUT, POST, DELETE and a URI used to obtain a resource  
should be used in a PUT to update the resources, and in DELETE to  
delete the resource. So if you have a web page that shows rooms and  
advertisements, and a teaser of recent news items, you should be able  
to delete all of them with a DELETE request to the same URI  
(right? :-)) Obviously this is not true. Web pages are presentation,  
and need to be treated a bit different than services.

Michael

---

<div class="post-metadata">

**Author:** ![Lza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/13edae/32.png) [@Lza](https://www.ruby-forum.com/u/Lza)\
**Post date:** [May 29, 2007, 12:21am UTC](https://www.ruby-forum.com/t/rest-design/105328/3 "2007-05-29T00:21:25Z")

</div>

Thank you for your response. Just a few comments.

So am I correct in saying that this situation suggests that I should  
develop the web application in a more RPC style way, being that REST  
will not support returning multiple resources? Therefore I should save  
any REST style interactions for when there is a single resource I am  
returning that I want to expose as a service?

Nested resources seem as if they would only allow me to nest one child  
element, any idea what would happen when I have multiple children on a  
resource.

Are there any other opinions out there on this?
