On Tue, Jul 18, 2017 at 4:01 PM, Mariano Martinez Peck <[hidden email]> wrote: --
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 ... Any idea? Thanks, _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
2017-07-18 19:57 GMT-03:00 Mariano Martinez Peck <[hidden email]>:
> 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. 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 [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On Wed, Jul 19, 2017 at 9:43 AM, Esteban A. Maringolo <[hidden email]> wrote: 2017-07-18 19:57 GMT-03:00 Mariano Martinez Peck <[hidden email]>: Cool. Thank you very much Esteban. Very helpful and detailed response. Really appreciated, Regards, _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |