[Seaside] Seaside-Rest question [WAS] Re: How can I make this kind of redirect in Seaside?

Mariano Martinez Peck marianopeck at gmail.com
Thu Jul 20 18:22:46 UTC 2017


On Wed, Jul 19, 2017 at 9:43 AM, Esteban A. Maringolo <emaringolo at gmail.com>
wrote:

> 2017-07-18 19:57 GMT-03:00 Mariano Martinez Peck <marianopeck at gmail.com>:
>
> > BTW... how can I allow something like this:
> >
> > <path: '/companyreport/{ticker}/{reportName}'>
> >
> > I then somehow I would like to parse the URL inside the method so that I
> > answer the correct response based on the URL ...
>
>
> You should have a method like:
>
> getTicker: ticker report: reportName
>   <get>
>   <path: '/companyreport/{ticker}/{reportName}'>
>
> There you'll have the ticker and reportName placeHolders mapped to the
> argument variable names. It is, the arguments of the method will hold
> whatever you put in those placeholders.
>
> But keep in mind this will only match a URI as a whole, if for some
> reason you add query parameters to the request, like
> '/companyreport/AAPL/dailyChange?format=csv', you'll need another
> method, with another name and path pragma.
>
> That's why I implemented the "variableQuery" pragma [1], so you can
> have a fixed URI but variable queries mapped to a single smalltalk
> method. But it was removed [2] because there was a proper way [3] of
> implementing it I ignored/didn't understand at that time.
>
> This part of the framework is powerful, but certainly lacking
> examples, and without the behavior of [1] or [3] is too rigid for a
> flexible API.
>
> I could explain how it works, and use it as I do, but I can't tell I
> completely understand it as probably its creator does.
>
>

Cool. Thank you very much Esteban. Very helpful and detailed response.
Really appreciated,



> Regards,
>
> Esteban A. Maringolo
>
> [1] http://forum.world.st/New-Seaside-REST-Core-extension-td4872995.html
> [2] http://forum.world.st/REST-quot-variable-queries-quot-
> td4941376.html#a4941377
> [3] http://lists.squeakfoundation.org/pipermail/seaside/2014-
> December/031314.html
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20170720/7a43ff0b/attachment-0001.html>


More information about the seaside mailing list