Jump to content

taophp

Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • First Name
    Stéphane
  • Last Name
    Mourey

Recent Profile Visitors

113 profile views

taophp's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello everybody, i'm trying to use the PrestaShop web service to update the tracking number of an order. Doing, an error occurs that I do not understand. First, I get all order_carriers associations : Request: GET http://myshop.com/api/order_carriers Answer: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <order_carriers> <order_carrier id="1" xlink:href="http://myshop.com/api/order_carriers/1"/> <order_carrier id="2" xlink:href="http://myshop.com/api/order_carriers/2"/> [...] <order_carrier id="41" xlink:href="http://myshop.com/api/order_carriers/41"/> <order_carrier id="42" xlink:href="http://myshop.com/api/order_carriers/42"/> </order_carriers> </prestashop> I display informations about the last. Request: GET http://myshop.com/api/order_carriers/42 Answer: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <order_carrier> <id> <![CDATA[42]]> </id> <id_order xlink:href="http://myshop.com/api/orders/120"> <![CDATA[120]]> </id_order> <id_carrier xlink:href="http://myshop.com/api/carriers/1"> <![CDATA[1]]> </id_carrier> <id_order_invoice> <![CDATA[20]]> </id_order_invoice> <weight> <![CDATA[0.000000]]> </weight> <shipping_cost_tax_excl> <![CDATA[0.000000]]> </shipping_cost_tax_excl> <shipping_cost_tax_incl> <![CDATA[0.000000]]> </shipping_cost_tax_incl> <tracking_number></tracking_number> <date_add> <![CDATA[2017-09-25 11:04:00]]> </date_add> </order_carrier> </prestashop> I try to update using the same informations but the tracking number. Request : PUT http://myshop.com/api/order_carriers/42 <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <order_carrier> <id> <![CDATA[42]]> </id> <id_order xlink:href="http://myshop.com/api/orders/120"> <![CDATA[120]]> </id_order> <id_carrier xlink:href="http://myshop.com/api/carriers/1"> <![CDATA[1]]> </id_carrier> <id_order_invoice> <![CDATA[20]]> </id_order_invoice> <weight> <![CDATA[0.000000]]> </weight> <shipping_cost_tax_excl> <![CDATA[0.000000]]> </shipping_cost_tax_excl> <shipping_cost_tax_incl> <![CDATA[0.000000]]> </shipping_cost_tax_incl> <tracking_number>123</tracking_number> <date_add> <![CDATA[2017-09-25 11:04:00]]> </date_add> </order_carrier> </prestashop> Answer: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <code> <![CDATA[85]]> </code> <message> <![CDATA[Validation error: "Property OrderCarrier->id_order is not valid"]]> </message> </error> </errors> </prestashop> It seems that my id_order in not valid. But I did not change this information, and I've checked that order with this id exists. Requête: GET http://aw03.abw.lan/api/orders/120 Answer: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <order> <id> <![CDATA[120]]> </id> [...] <id_carrier xlink:href="http://myshop.com/api/carriers/1"> <![CDATA[1]]> </id_carrier> <current_state xlink:href="http://myshop.com/api/order_states/2"> <![CDATA[2]]> </current_state> [...] <invoice_number> <![CDATA[20]]> </invoice_number> <invoice_date> <![CDATA[2017-09-25 11:49:42]]> </invoice_date> <delivery_number> <![CDATA[0]]> </delivery_number> <delivery_date> <![CDATA[0000-00-00 00:00:00]]> </delivery_date> <valid> <![CDATA[1]]> </valid> <date_add> <![CDATA[2017-09-25 11:04:00]]> </date_add> <date_upd> <![CDATA[2017-09-25 11:49:51]]> </date_upd> <shipping_number notFilterable="true"></shipping_number> [...] <reference> <![CDATA[FZRUHKGDF]]> </reference> [...] </order> </prestashop> On the other side, I have no error, including in the web server log. Can anyone help to solve this issue ? Regards, Taophp
  2. C'est un paramètre obligatoire. Voici la réponse que j'obtiens lorsque je le supprime : <?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 "id_order" required]]> </message> </error> </errors> </prestashop>
  3. Bonjour, J'essaie d'utiliser le web service de PrestaShop pour mettre à jour une commande afin d'indiquer un numéro de tracking transmise par un transporteur. Ce faisant, je rencontre une erreur que je ne comprends pas. Tout d'abord, je récupère toutes les associations commmande/transporteur. Requête: GET http://myshop.com/api/order_carriers Réponse: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <order_carriers> <order_carrier id="1" xlink:href="http://myshop.com/api/order_carriers/1"/> <order_carrier id="2" xlink:href="http://myshop.com/api/order_carriers/2"/> [...] <order_carrier id="41" xlink:href="http://myshop.com/api/order_carriers/41"/> <order_carrier id="42" xlink:href="http://myshop.com/api/order_carriers/42"/> </order_carriers> </prestashop> J'affiche les informations dont je dispose sur la dernière. Requête: GET http://myshop.com/api/order_carriers/42 Réponse: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <order_carrier> <id> <![CDATA[42]]> </id> <id_order xlink:href="http://myshop.com/api/orders/120"> <![CDATA[120]]> </id_order> <id_carrier xlink:href="http://myshop.com/api/carriers/1"> <![CDATA[1]]> </id_carrier> <id_order_invoice> <![CDATA[20]]> </id_order_invoice> <weight> <![CDATA[0.000000]]> </weight> <shipping_cost_tax_excl> <![CDATA[0.000000]]> </shipping_cost_tax_excl> <shipping_cost_tax_incl> <![CDATA[0.000000]]> </shipping_cost_tax_incl> <tracking_number></tracking_number> <date_add> <![CDATA[2017-09-25 11:04:00]]> </date_add> </order_carrier> </prestashop> Je fais une mise à jour en renvoyant les mêmes informations, en ajoutant seulement le numéro de tracking : Requête: PUT http://myshop.com/api/order_carriers/42 <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <order_carrier> <id> <![CDATA[42]]> </id> <id_order xlink:href="http://myshop.com/api/orders/120"> <![CDATA[120]]> </id_order> <id_carrier xlink:href="http://myshop.com/api/carriers/1"> <![CDATA[1]]> </id_carrier> <id_order_invoice> <![CDATA[20]]> </id_order_invoice> <weight> <![CDATA[0.000000]]> </weight> <shipping_cost_tax_excl> <![CDATA[0.000000]]> </shipping_cost_tax_excl> <shipping_cost_tax_incl> <![CDATA[0.000000]]> </shipping_cost_tax_incl> <tracking_number>123</tracking_number> <date_add> <![CDATA[2017-09-25 11:04:00]]> </date_add> </order_carrier> </prestashop> Réponse: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <code> <![CDATA[85]]> </code> <message> <![CDATA[Validation error: "Property OrderCarrier->id_order is not valid"]]> </message> </error> </errors> </prestashop> Mon id de commande n'est pas valide, paraît-il. Alors que je n'ai pas modifié cette information et que j'ai vérifié que l'id correspondant existe bel et bien. Requête: GET http://aw03.abw.lan/api/orders/120 Réponse: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <order> <id> <![CDATA[120]]> </id> [...] <id_carrier xlink:href="http://myshop.com/api/carriers/1"> <![CDATA[1]]> </id_carrier> <current_state xlink:href="http://myshop.com/api/order_states/2"> <![CDATA[2]]> </current_state> [...] <invoice_number> <![CDATA[20]]> </invoice_number> <invoice_date> <![CDATA[2017-09-25 11:49:42]]> </invoice_date> <delivery_number> <![CDATA[0]]> </delivery_number> <delivery_date> <![CDATA[0000-00-00 00:00:00]]> </delivery_date> <valid> <![CDATA[1]]> </valid> <date_add> <![CDATA[2017-09-25 11:04:00]]> </date_add> <date_upd> <![CDATA[2017-09-25 11:49:51]]> </date_upd> <shipping_number notFilterable="true"></shipping_number> [...] <reference> <![CDATA[FZRUHKGDF]]> </reference> [...] </order> </prestashop> Je n'ai par ailleurs aucune autre erreur, y compris dans le log du serveur. Quelqu'un peut-il m'expliquer ce qui cloche et comment y remédier ?
×
×
  • Create New...