Hi Vincent,

Vincent <vincent.lari <at> yahoo.ca> writes:

> 
> Hi Piyush,
> 
> > /accounts/search/less_than/10000
> > /accounts/search/greater_than/10000
> > /accounts/search/between/10000/20000
> 
> The issue I have with this approach is that it doesn't allow to mix several
> search criteria (balance_less_than=2000&status=active).
> 
> I'd like to have:
>   1) /accounts/1234  -> retrieve an individual account
>   2) /accounts?balance_less_than=2000&status=active  ->search
> 
> That's why I was hoping creating my restlets like so:
>     attach("/accounts/[0-9]+$", new GetAccountHandler())
>     attach("/accounts?[.]+$", new SearchAccountHandler())
> would work.
> 
> Now, following your idea, I could do:
>     attach("/accounts/search?[.]+$", new SearchAccountHandler())
> 
> and access it with  /accounts/search?balance_less_than=2000&status=active
> 
> But it kind of bothers me to have to have to specify the action twice (the 
> http
> GET method and the 'search' portion of the url).
> 
> > and restlets that support that class because they
> > understand the URLs ..
> 
> Well, it turns out restlets only understand the base of the URLs.

We had a similar issue and I think this is an area where the REST philosophy
is somewhat stressed. We thought of putting the search criteria on the
URI but in our case, we could easily overrun the length restrictions because
we have so many criteria.

We decided to make a web service, use a POST and put the criteria in the 
XML. Then the URI could be /accounts/search which is pretty easy to
deal with.

I'd be interested in hearing more on this topic.

Sean
> -Vincent.
> 
> 



Reply via email to