Jump to content

Adding new customer to Prestashop using Web service


Recommended Posts

Hi there,

 

I am trying to add new customer to my Prestashop using the Web service however I keep on getting an error. The error says:

 

<?xml version="1.0" encoding="UTF-8"?>

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">

<errors>

<error>

<code><![CDATA[127]]></code>

<message><![CDATA[xml error : String could not be parsed as XML

XML length : 0

Original XML : ]]></message>

</error>

</errors>

</prestashop>

 

Here is my sample XML file below:

 

<?xml version="1.0" encoding="UTF-8"?>

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">

<customers>

<customer>

<passwd>989085598595b8d655754f9c01ff79d8</passwd>

<lastname>Gwapo</lastname>

<firstname>Richard</firstname>

<email>[email protected]</email>

</customer>

</customers>

</prestashop>

 

 

I am using a REST Client to test this process. My URI is http://51FELCCAYL9VGB9GUXEQJVRSCWWH5CR6@localhost/prestashop/api/customers/?schema=blank and the method is POST.

 

I hope someone knows the answer to my problem.

 

Thanks,

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Hello

 

To POST , you have to send your xml content in a parameter called xml

http://yourul/api/customers/?xml='content of your xml'

 

You can see that in the file webservice/dispatcher.php

Row 61

if (isset($_REQUEST['xml']))
{
// if a XML is in POST
$input_xml = stripslashes($_REQUEST['xml']);
}

 

I use the parameter schema=synopsis instead of schema=blank for my project to create things via the API.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...