[FLOW3-general] Question about implementing REST interface
Bastian Waidelich
bastian at typo3.org
Mon Feb 4 13:45:37 CET 2013
Mario Beiser wrote:
Hi Mario,
> I implemented some of my controllers as an instance of
> TYPO3/Flow/Mvc/Controllers/RestController.
>
> When I am going to query them via curl I got a 200, hence I got the result
> of the listAction. This is absolutely
> ok, if I am going to send a GET request.
>
> BUT I got the same answer, although I am sending a POST or PUT. I thought,
> that Flow maps my requests
> against the according actions. So I am wondering, if I have to set some
> routes for the actions or do I have
> to add some logic to my controller to decide?
Yes, currently you need two routes per resource.
Did you follow step 3 of the RestTest example? "Activate the package
SubRoutes by copying the following snippet on top of your
Configuration/Routes.yaml file".
Note that the AbstractRestController will only "rewrite" the action if
the requested action is "index" (see [1]).
Note² The REST support in Flow is still experimental and subject to
change. Once [2] is resolved you probably won't need to write custom
routes any longer.
>
> Normally the RestController should cope that...
>
> ps: followed the great example of Bastian Waidelich:
> https://github.com/bwaidelich/Wwwision.RestTest
Thank you, I'm glad that it helps you and I'll provide some more
advanced examples soon.
[1]
http://git.typo3.org/FLOW3/Packages/TYPO3.FLOW3.git/blob/HEAD:/Classes/TYPO3/Flow/Mvc/Controller/RestController.php#l52
[2] http://forge.typo3.org/issues/37604
--
Bastian Waidelich
--
Core Developer Team
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the FLOW3-general
mailing list