REST: Handling homepage and pagination for XML

Hi you all,

I have two questions regarding a REST app and the XML responses:

  • Homepage: I want to have a kind of homepage to list all the list of
    resources the user can access to. I’ve read I can do it with just an
    index.html. However, my app also offers the response in XML so, what if
    the client want the XML? Can I have an index.rxml too? In [1], they
    offer the possibility to have a HomeController to manage this kind of
    singleton resource. What do you think is the best choice?

  • Pagination: I have the pagination of my resources managed with
    will_paginate plugin for HTML responses. How can I do it for the XML
    response? The only option will be doing it by hand (dunno, maybe
    counting the resources, dividing this number by x, being x the number of
    resources I want to list per page…and all this in the whatever.rxml
    file…this is not quite right). Suggestions?

Thanks.

[1] Leonard Richardson and Sam Ruby, Restful Web Services, O’Reilly.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs