Product update
URL del Webservice : https://sws.spartoo.ch/mp/xml_maj_stock_batch.phpThis webservice updates the product stock on the Spartoo website.
Every time you send a product, the webservice provides you with a code, which confirms that your update went through successfully.
This webservice updates the product stock. It can be used to send an entire catalogue or only a few products.
This webservice operates in "Update" mode and not in "Elimination" mode. In other words, products that are not sent in the XML will not be removed.
To remove a product from the website, you must update the stock to 0.
Lista dei parametri
The parameters of this webservice must imperatively be in POSTParameter | Description |
---|---|
partner | Must contain your user ID: |
xml | XML Character string containing the list of items to be updated |
Format du paramètre xml
I campi testo devono essere protetti da dei balises CDATA se contengono dei caratteri speciali che rendono il XML invalido.
<catalogue> <products> <product> <reference_partenaire>string</reference_partenaire> <size_list> <size> <size_reference>string</size_reference> <size_quantity>int</size_quantity> <languages> <language> <code>string</code> <product_price>float</product_price> <discount> <startdate>timestamp</startdate> <stopdate>timestamp</stopdate> <price_discount>float</price_discount> <rate>int</rate> <sales/> </discount> </language> <!-- ... Più opzioni "language" possibili ... --> </languages> <!-- ... Più opzioni "languages" possibili ... --> </size> <size> <size_reference>string</size_reference> <size_quantity>int</size_quantity> </size> </size_list> </product> <product> <reference_partenaire>string</reference_partenaire> <size_list> <size> <size_reference>string</size_reference> <size_quantity>int</size_quantity> </size> <size> <size_reference>string</size_reference> <size_quantity>int</size_quantity> </size> </size_list> </product> </products> </catalogue>
Descrzione dei campi del XML d'entrata
Tag | Description | Mandatory |
---|---|---|
reference_partner |
Product ID of the merchant. It is the sku that identifies a brand's product in a specific colour The product ID can only contain alphanumeric characters as well as the characters - (dash) _ (underscore) and . (full stop). |
Yes |
product_quantity |
Total stock of a product Unknown if one or more of the size_quantity tags is given for the product. For one-sized products, one product_quantity tag is needed if the size_quantity tag is not specified. |
No |
size |
List of sizes and their stock. Optional for one-sized products ( Bags / Accessories ). Otherwise, it is mandatory. |
Yes / No |
size_quantity | The stock must be specified for each size. To deactivate a product, the stock must be set to 0. Once the stock has been set to 0, the product is deactivated and is removed from Spartoo. |
Yes |
size_reference | Product reference for the size. | Yes | product_price | Price for the size | No |
discount |
Allows you to apply a promotion to the product. The rate of the discount concerns the price reduction as a percentage of the field product_price. The price_discount of the discount concerns the discounted price of the product. The discount percentage displayed will be calculated. If both fields are present, the price_discount has priority over the field rate. If the discount is immediate, there is no need to specify the startdate. If the stopdate is not specified, the default duration of the promotion will be one month. If the sales field is specified, the promotion will be a sale promotion. Otherwise, it will be a classic promotion. Specifying this parameter allows products to be displayed on the sales page during sales periods. |
No |
Exemple de paramètre xml
<catalogue> <products> <product> <reference_partenaire>98</reference_partenaire> <size_list> <size> <size_reference>98_38</size_reference> <size_quantity>5</size_quantity> <languages> <language> <code>FR</code> <product_price>100.00</product_price> <discount> <startdate>1199170800</startdate> <stopdate>1204354800</stopdate> <price_discount>90.00</price_discount> <rate>10</rate> <sales/> </discount> </language> <!-- ... Più opzioni "language" possibili ... --> </languages> <!-- ... Più opzioni "languages" possibili ... --> </size> <size> <size_reference>98_39</size_reference> <size_quantity>7</size_quantity> </size> </size_list> </product> <product> <reference_partenaire>158_tailor</reference_partenaire> <size_list> <size> <size_reference>158_37</size_reference> <size_quantity>2</size_quantity> </size> <size> <size_reference>158_36</size_reference> <size_quantity>0</size_quantity> </size> </size_list> </product> </products> </catalogue>
Formato di XML in
<catalogue> <products> <product> <reference_partenaire>string</reference_partenaire> <size_list> <size> <size_reference>string</size_reference> <errors>int</errors> </size> </size_list> </product> <!-- ... Più opzioni "product" possibili ... --> </products> </catalogue>
Lista dei codici d'errore del webservice
Codice | Descrizione |
---|---|
1 | Nessun errore di parametro |
-1 | Il prametro partenaire non è parametrato o è vuoto |
-2 | Il parametro partenaire non esiste |
-11 | Il prametro xml non è parametrato o è vuoto |
-13 | Il prametro products_size_reference non è parametrato o è vuoto |
-15 | Errore di sintassi XML, verificare il file XML |
-18 | Lo stock è identico a quello in database, dunque non è stato aggiornato |
-20 | Impossibile aggiornare lo stock. La taglia non è più valida per questo prodotto quindi lo stock per questo prodotto e per questa taglia è a 0. |
-31 | Questa referenza di taglia non esiste |
-428 | Il vostro conto non é più attivo, non potete quindi più fare chiamate Webservice |
-429 | Avete effettuato troppe chiamate a questo webservice nell' ultima ora |
Esempi di reso XML
Esempio di risposta a una chiamata web service KO :
<catalogue> <products></products> <errors>-1</errors> </catalogue>
Esempio di una risposta al web service OK :
<catalogue> <products> <product> <reference_partenaire>EEAJBCC</reference_partenaire> <size_list> <size> <size_reference>EEAJBCC_38</size_reference> <errors>1</errors> </size> </size_list> </product> <product> <reference_partenaire>KJHGFDS</reference_partenaire> <size_list> <size> <size_reference></size_reference> <errors>-13</errors> </size> </size_list> </product> </products> </catalogue>