eZ Community » Forums » eZ Publish 5 Platform » Extending the Rest API

Extending the Rest API

Extending the Rest API

Tuesday 22 July 2014 6:11:43 pm - 2 replies

Hi Guys,

i am playing around with the rest api and the tutorials regarding to this topic (https://doc.ez.no/display/EZP/Extending+the+REST+API respectively https://doc.ez.no/display/EZP52/Extending+the+REST+API)

For better developing i installed a local ez Community Project 2014.3.

Now im trying to extend the rest api based on the tutorials i mentioned above. No matter what tutorial i use, i didnt get my rest bundle working well.

So here are my Questions based on https://doc.ez.no/display/EZP/Extending+the+REST+API:

  1. Why does i have to create this controller? It is never used later? Maybe this is the needed controller?
  2. My visitor could not be found, since it is declared in the services.yml as class. The Class Hello is placed in My/Bundle/RestBundle/Rest/Controller/Default. It is using the Namespace My\Bundle\RestBundle\Rest\ValueObjectVisitor. It could not be found, so i created a folder ValueObjectVisitor and moved the default.php file containing the class Hello inside this folder. 
  3. 2 caused a new error: "The autoloader expected class "My\Bundle\RestBundle\Rest\Controller\DefaultController" to be defined in file "/ez5/src/My/Bundle/RestBundle/Rest/Controller/DefaultController.php". The file was found but the class was not in it, the class name or namespace probably has a typo.". So i changed the Namespace of my My/Bundle/RestBundle/Rest/Controller/DefaultController.php from My\Bundle\RestBundle\Controller to My\Bundle\RestBundle\Rest\Controller.

The pain is still going on. 

So is there any useful tutorial or manual with describes how to extend the ez-rest api? Otherwise would it be possible to provide me the files of the tutorials, provided they are working?

Also it seems, that there are errors in one or both of the tutorials and everybody who wants to work with it have to diff between both tutorials to get something (not) working. 

... not really motivating for me...

Thanks for your help,


Wednesday 23 July 2014 9:09:03 am

1. This is a typo. The right path is


2. Your structure should look like this

3. Double check your yml settings and the namespaces in your files.
I also fought this tutorial but I won in the endblunk.gif Emoticon

Thursday 24 July 2014 10:50:44 am

Not a tutorial, but an example: https://github.com/gggeek/ez5playground/tree/master/EezRESTAPIBundle

Note: it does not use the visitor pattern. It is in many ways not "best practice" but it does highlight how you can quickly develop extended-rest-apis


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from