Jump to content

Recommended Posts

Bonjour,

J'essaye de consommer le service web prestashop avec un logiciel type Curl. 

Le GET marche bien comme suis:     

GET ("https://domaine/api/customers/1?output_format=JSON",  authenticate("FJ1T7FE6JVT8PHME5SK8D9A34RFDGT56",""))

 

Par contre le POST ne marche pas:

POST ("https://domaine/api/customers/1", authenticate("FJ1T7FE6JVT8PHME5SK8D9A34RFDGT56",""), body = body1, content_type("text/xml"))

 

Le message d'erreur recu est le suivant:

Response [https://domaine/api/customers/1]
  Date: 2019-08-07 14:01
  Status: 400
  Content-Type: text/xml;charset=utf-8
  Size: 232 B
<?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 "passwd" required]]></message>
</error>
</errors>
</prestashop>

 

La version de prestashop est 1.7.5.1 est tous les autres methodes d'authetication marchent pas (i.e. en incluant la ws_key dans l'url)

Merci!

Link to comment
Share on other sites

Bonjour,

Le champ est bien présent mais vide "".

J'ai aussi essayé en dupliquant la key en tant que password:

POST ("https://domaine/ps/api/customers/1",  authenticate("FJ1T7FE6JVT8PHME5SK8D9A34RFDGT56","FJ1T7FE6JVT8PHME5SK8D9A34RFDGT56"), body = body1, content_type("text/xml"))

 

Puis le GET marche OK mais pas le POST

Merci!

 

 

 

Link to comment
Share on other sites

Effectivement, le body doit contenir l'information suivante pour ce cas (créer un nouveau Client):

<prestashop>
<customer>
<passwd>xxxxx</passwd>
<lastname>xxxxx</lastname>
<firstname>xxxxx</firstname>
<email>xxxxx</email>
<birthday>xxxxx</birthday>
</customer>
</prestashop>

 

Merci beaucoup de votre aide!

Edited by A Zuniga (see edit history)
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...