Question

I would like to set up a Rest Controller in flow3. I have checked the Restcontroller class, but I actually didn't understand what should I do in order to make a derived class to work. I mean:

class myRestController extends TYPO3\FLOW3\MVC\Controller\RestController{
...
}

And how should I set up the routing?

Thanks! David

Was it helpful?

Solution

First, your controller should be named MyRestController and not myRestController. (Flow3 code guidelines)

Second, in a Routes.yaml (probably in your package) file place:

   name: 'RouteName'                                                                                                                                                                                                                                                     
     uriPattern: 'rest/myrest'
     defaults:
       '@package':    'Your.Complete.Package.Name'
       '@controller': 'MyRest'
       '@format':     'json'

Lastly implement the methods

index - for http get without resource show - for http get with resource create - for http post update - for http put delete - for http delete

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top