RESTful request with parameters?

Hi,

I've implemented a restful app where I can post comments.
If I use http://127.0.0.1:3000/programs/1/comments I get all the
comments for program 1

In the main page of the programs I can see all the programs and the LAST
comment for each program. That I use a helper function that just takes
the last comment.

Now. I want to do the same thing but the response is sent to a client in
xml.
So I can http://127.0.0.1:3000/programs/1/comments.xml and again I get
xml for all the comments.

What is the best way to request the last comment? Using the same request
but adding a parameter? Creating a custom action?

Thanks

I would add a parameter instead of a custom action:

/programs/1/comments?filter=last

In your controller, you can look at params[:filter] to find out what
kind of filter the client wants - you could support values like last,
first, or a number if they want to simply limit the result set.

Jeff
softiesonrails.com

Jeff Cohen wrote:

I would add a parameter instead of a custom action:

/programs/1/comments?filter=last

Yeah I'll do it like that. Somehow I get the feeling that adding
parameters to a clean restful request breaks the rest rules. But I guess
that is a normal way of doing it.

Thanks!