简体   繁体   中英

POST api/customers/ to register user Prestashop Email Invalid

Im trying to register user to my Prestashop store through postman,

I use post mydomain/api/customers,

In body I use raw data like this:

    <?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <customer>
        <passwd>
            testpassword
        </passwd>
        <lastname>
            testlastname
        </lastname>
        <firstname>
            testfirstname
        </firstname>
        <email>
            testemail@mail.com
        </email>
    </customer>
</prestashop>

And I have error code that Customer -> Email is not valid, When I use this xml as a body:

<customer>
    <passwd>
        testpassword
    </passwd>
    <lastname>
        testlastname
    </lastname>
    <firstname>
        testfirstname
    </firstname>
    <email>
        testemail@mail.com
    </email>
</customer>

I got response that passwd is required, anyone have any idea how do I work with this webservice api?

You are using wrong input xml; I am able to create customer with following request body. Make sure to add Prestashop tag as parent tag.

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
  <customer>
    <passwd>admin@123</passwd>
    <lastname>Doe</lastname>
    <firstname>John</firstname>
    <email>john.doe@yopmail.com</email>
  </customer>
</prestashop>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM