Friday, October 21, 2011

Re: How do you go about making a ReST service filterable (search via ReST)

On Fri, Oct 21, 2011 at 2:38 AM, Greg <gskerman@gmail.com> wrote:
> Still a bit stuck here with ReST. I have the index displaying as XML,
> and JSON - so its a good start...
>
> however the list could end up being quite large, so I want to
> condition it by fields.
>
> Conceptually something like:
>
> logs.xml?source=&class=&method=& etc, allowing the caller to pass
> basic query parameters to the index action.
>
> I don't want to use $_GET though, I'd prefer to use something like
> named parameters, but unsure how to make this play nice.

For GET requests, have a look at $this->request->query.


>
> Do i need to set up custom ReST routing instead of mapResources() to
> achieve this?

You can use mapResources to make _fancy_ URLs, but if you want to pass
parameters to your index view like in the example above, you can just
refer to the default configuration.


Cheers,
Matteo

--
http://www.matteolandi.net/

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate