This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » REST: XML Output

REST: XML Output

REST: XML Output

Tuesday 17 April 2012 8:26:58 am - 5 replies


How do I get the eZ Publish REST interface to output XML instead of JSON?

Kind regards,


Tuesday 17 April 2012 9:18:02 pm

Hi Sebastiaan,

Good question happy.gif Emoticon As i could find Mvcroute should be /content/node/<node_id>/listAtom

Its defined on extension/ezprestapiprovider/classes/rest_provider.php  line 19

But its not working for me. A bug? or a wrong configuration? Should be explored ...


Edit: check a little bit more on kernel/private/rest/classes/controllers/atom.php 

Problem is line 42 :

'nodeUrl' => $baseUri . $this->getRouter()->generateUrl( 1, array( 'nodeId' => $node->locations->node_id ) ) );

Parameters 1 is wrong. 


Modified on Tuesday 17 April 2012 9:47:18 pm by Philippe Vincent-Royol

Wednesday 18 April 2012 8:30:07 pm

Hi Philippe,

Thank you for your reply! It looks indeed like the '1' should be replaced with 'ezpListAtom'. The implementation of the Atom class seems to lacks a lot of functionality in comparison to the JSON implementation. Anyway, i need to implement a custom xml scheme, rather than use the existing JSON or Atom functionality, so i suppose i need to extend the standard REST functionality.

Kind regards.

Modified on Wednesday 18 April 2012 8:30:39 pm by S V

Thursday 19 April 2012 10:03:49 am

Mapping a php data structure to json is pretty straitghtforward, whereas there is no such 1:1 mapping possible with xml, the latter having a richer semantic model (eg. using an xml attribute or element for an object's member?).

I think this is the reason there is no "default" mapping in the REST layer, and also why there has to be (imho) a "mapping" layer between the php data structures that are output by php methods exposed as REST calls and the xml - be it done in tpl, xslt or whatever.

Any advance in this area is welcome - please start working on the latest CP version, as the REST plumbing has seen quite a lot of changes from version 4.6. Note that there is some interesting rest work available in the ezcontenstaging extension on github (the one in the gggeek account)

Thursday 19 April 2012 11:12:05 pm

Hi Gaetano, thanks for your reply. It turns out there is another option: using the ezcMvcPhpViewHandler, that can be used to call a php file. That php file can then call "$contentModule->run( 'view', etc," which makes it possible to return the standard 'full' templates. Doing a design where the full templates contain xml rather than html then allow for a REST solution with a custom XML scheme. I'll write a blog post about it once i get the details right.

Modified on Thursday 19 April 2012 11:14:49 pm by S V

Sunday 22 April 2012 4:20:19 pm

The blog post is now available at:


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

36 542 Users on board!

Forums menu

Proudly Developed with from