For Magento 1.9 I'm working on a module where I defined a custom REST route to retrieve all categories with subcategories. When I call <MAGE>/api/rest/eoarestapi/categories?type=rest
the function _retrieveCollection()
from the class Namespace_Restapi_Model_Api2_Category_Rest_Guest_V1
is being called. So far so good.
Now I am having the problem, that it returns the response in XML only and when I set the header explicitly to Accept: application/json
, then I get the error 406 Not Acceptable An appropriate representation of the requested resource /api/rest/products could not be found on this server. Available variants: api.php , type application/x-httpd-php
This seems very strange to me as I can remember having worked with JSON response back in Magento 1.8.
As a fix I found this and that solution to retrieve JSON which works, but it doesn't seem to be a nice solution as it looks like it disables XML response completely.
Is there a better way to enable JSON output from the REST API in Magento 1.9? Does anybody have some background knowledge on this?