Jump to content

Add products by API


LowHZ21

Recommended Posts

Hi all,

I'm working to add products to Prestashop by using the API

I have to do it with VB.NET, so i have to make a post call to the webservice.

 

Where is the issue?

I got error 400 as response of the api post call.

 

Here is the xml:

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
<id><![CDATA[9]]></id>
<id_manufacturer><![CDATA[0]]></id_manufacturer>
<id_supplier><![CDATA[0]]></id_supplier>
<id_category_default xlink:href="http://prestashop.tooeasylab.it/api/categories/2"><![CDATA[2]]></id_category_default>
<new></new>
<cache_default_attribute><![CDATA[0]]></cache_default_attribute>
<id_default_image notFilterable="true"></id_default_image>
<id_default_combination notFilterable="true"></id_default_combination>
<id_tax_rules_group xlink:href="http://prestashop.tooeasylab.it/api/tax_rule_groups/1"><![CDATA[1]]></id_tax_rules_group>
<position_in_category notFilterable="true"><![CDATA[7]]></position_in_category>
<manufacturer_name notFilterable="true"></manufacturer_name>
<quantity notFilterable="true"><![CDATA[0]]></quantity>
<type notFilterable="true"><![CDATA[simple]]></type>
<id_shop_default><![CDATA[1]]></id_shop_default>
<reference></reference>
<supplier_reference></supplier_reference>
<location></location>
<width><![CDATA[0.000000]]></width>
<height><![CDATA[0.000000]]></height>
<depth><![CDATA[0.000000]]></depth>
<weight><![CDATA[0.000000]]></weight>
<quantity_discount><![CDATA[0]]></quantity_discount>
<ean13></ean13>
<isbn></isbn>
<upc></upc>
<cache_is_pack><![CDATA[0]]></cache_is_pack>
<cache_has_attachments><![CDATA[0]]></cache_has_attachments>
<is_virtual><![CDATA[0]]></is_virtual>
<state><![CDATA[1]]></state>
<on_sale><![CDATA[0]]></on_sale>
<online_only><![CDATA[0]]></online_only>
<ecotax><![CDATA[0.000000]]></ecotax>
<minimal_quantity><![CDATA[1]]></minimal_quantity>
<price><![CDATA[10.000000]]></price>
<wholesale_price><![CDATA[0.000000]]></wholesale_price>
<unity></unity>
<unit_price_ratio><![CDATA[0.000000]]></unit_price_ratio>
<additional_shipping_cost><![CDATA[0.00]]></additional_shipping_cost>
<customizable><![CDATA[0]]></customizable>
<text_fields><![CDATA[0]]></text_fields>
<uploadable_files><![CDATA[0]]></uploadable_files>
<active><![CDATA[0]]></active>
<redirect_type><![CDATA[404]]></redirect_type>
<id_product_redirected><![CDATA[0]]></id_product_redirected>
<available_for_order><![CDATA[1]]></available_for_order>
<available_date><![CDATA[0000-00-00]]></available_date>
<show_condition><![CDATA[0]]></show_condition>
<condition><![CDATA[new]]></condition>
<show_price><![CDATA[1]]></show_price>
<indexed><![CDATA[0]]></indexed>
<visibility><![CDATA[both]]></visibility>
<advanced_stock_management><![CDATA[0]]></advanced_stock_management>
<date_add><![CDATA[2017-01-03 15:26:26]]></date_add>
<date_upd><![CDATA[2017-01-03 15:27:02]]></date_upd>
<pack_stock_type><![CDATA[3]]></pack_stock_type>
<meta_description><language id="1" xlink:href="http://prestashop.tooeasylab.it/api/languages/1"><![CDATA[]]></language></meta_description>
<meta_keywords><language id="1" xlink:href="http://prestashop.tooeasylab.it/api/languages/1"><![CDATA[]]></language></meta_keywords>
<meta_title><language id="1" xlink:href="http://prestashop.tooeasylab.it/api/languages/1"><![CDATA[]]></language></meta_title>
<link_rewrite><language id="1" xlink:href="http://prestashop.tooeasylab.it/api/languages/1"><![CDATA[test]]></language></link_rewrite>
<name><language id="1" xlink:href="http://prestashop.tooeasylab.it/api/languages/1"><![CDATA[Test]]></language></name>
<description><language id="1" xlink:href="http://prestashop.tooeasylab.it/api/languages/1"><![CDATA[]]></language></description>
<description_short><language id="1" xlink:href="http://prestashop.tooeasylab.it/api/languages/1"><![CDATA[]]></language></description_short>
<available_now><language id="1" xlink:href="http://prestashop.tooeasylab.it/api/languages/1"><![CDATA[]]></language></available_now>
<available_later><language id="1" xlink:href="http://prestashop.tooeasylab.it/api/languages/1"><![CDATA[]]></language></available_later>
<associations>
<categories nodeType="category" api="categories">
<category xlink:href="http://prestashop.tooeasylab.it/api/categories/2">
<id><![CDATA[2]]></id>
</category>
</categories>
<images nodeType="image" api="images"/>
<combinations nodeType="combination" api="combinations"/>
<product_option_values nodeType="product_option_value" api="product_option_values"/>
<product_features nodeType="product_feature" api="product_features"/>
<tags nodeType="tag" api="tags"/>
<stock_availables nodeType="stock_available" api="stock_availables">
<stock_available xlink:href="http://prestashop.tooeasylab.it/api/stock_availables/53">
<id><![CDATA[53]]></id>
<id_product_attribute><![CDATA[0]]></id_product_attribute>
</stock_available>
</stock_availables>
<accessories nodeType="product" api="products"/>
<product_bundle nodeType="product" api="products"/>
</associations>
</product>
</prestashop>

prestashop logs report this error:

[Thu Jan 12 10:00:22.310336 2017] [fcgid:warn] [pid 30796] (70008)Partial results are valid but processing is incomplete: [client x.x.x.x.x:xxxx] mod_fcgid: can't get data from http client
Edited by LowHZ21 (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...