Search code examples
phpxmlcurlprestashop-1.6

Prestashop web service: <![CDATA[Internal error. To see this error please display the PHP errors.]]>


This call

curl -H "Content-type: application/xml" -vX POST 'http://[email protected]/api/products/' -d "<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>
<prestashop xmlns:xlink=\"http://www.w3.org/1999/xlink\">
<product>
</product>
</prestashop>"

always returns

< HTTP/1.1 400 Bad Request
< Date: Wed, 14 Sep 2016 14:26:02 GMT
< Server: Apache/2.4.18 (Unix) PHP/5.5.34
< Vary: Authorization
< X-Powered-By: PrestaShop Webservice
< Access-Time: 1473863162
< PSWS-Version: 1.6.1.7
< Execution-Time: 0.024
< Content-Length: 241
< Connection: close
< Content-Type: text/xml;charset=utf-8
<
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<errors>
<error>
<message><![CDATA[Internal error. To see this error please display the PHP errors.]]></message>
</error>
</errors>
</prestashop>
* Closing connection 0

but php log does not contains content about this error. What's happening? And how can I solve this problem?


Solution

  • in config/defines.inc.php change constant to:

    define('_PS_MODE_DEV_', true);
    

    and you will get expecting error message in body:

    <?xml version="1.0" encoding="UTF-8"?>
    <prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <errors>
    <error>
    <code><![CDATA[41]]></code>
    <message><![CDATA[parameter "price" required]]></message>
    </error>
    </errors>
    </prestashop>