Jump to content

API create resource


Ciro Marciano

Recommended Posts

Hi!

I'm starting to use the PS API but I cannot create a resource, I'm able to list a resource but I don't know why the creation doesn't work

I'm trying with a simple table (countries) using postman and putting in the body (raw & xml) this one:

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<country>
	<id>9999</id>
	<id_zone>1999999</id_zone>
	<id_currency>0</id_currency>
	<call_prefix>999999</call_prefix>
	<iso_code>ZZ</iso_code>
	<active>0</active>
	<contains_states>0</contains_states>
	<need_identification_number>0</need_identification_number>
	<need_zip_code>1</need_zip_code>
	<zip_code_format>NNNNN</zip_code_format>
	<display_tax_label>1</display_tax_label>
	<name><language id="1"></language></name>
</country>
</prestashop>

 

using a POST call

 

https://ncssrl.com/pshop/api/countries/?ws_key=mykey

but I get in response the list of all the countries, without my new one.

tried also with a simple new currency with this xml in body

<prestashop>
<currencies>
<currency>
<id>2</id>
<names>
<language id="1" xlink:href="https://www.ncssrl.com/pshop/api/languages/1">US Dollar</language>
</names>
<name notFilterable="true">US Dollar</name>
<symbol>
<language id="1" xlink:href="https://www.ncssrl.com/pshop/api/languages/1">$</language>
</symbol>
<iso_code>EUR</iso_code>
<numeric_iso_code>840</numeric_iso_code>
<precision>2</precision>
<conversion_rate>1.000000</conversion_rate>
<deleted>0</deleted>
<active>1</active>
<unofficial>0</unofficial>
<modified>0</modified>
<pattern>
<language id="1" xlink:href="https://www.ncssrl.com/pshop/api/languages/1"></language>
</pattern>
</currency>
</currencies>
</prestashop>

postman response says 200 OK but only shows me the old currency and not the new one.

 

why?

Edited by Ciro Marciano (see edit history)
Link to comment
Share on other sites

I'm trying to create a new product with API URL, but I cannot get any error and any new product created. why?

this is my xml

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product>
        <id_shop_default>1</id_shop_default>
        <name>
            <language id="1">CIRO PROVA</language>
        </name>
        <price>9.80</price>
        <reference>A-10273</reference>
        <description>CIRO PROVA</description>
        <active>1</active>
        <advanced_stock_management>1</advanced_stock_management>
        <id_tax_rules_group>1</id_tax_rules_group>
        <width>0.000000</width>
        <height>0.000000</height>
        <depth>0.000000</depth>
        <weight>0.000000</weight>
        <on_sale>0</on_sale>
        <online_only>0</online_only>
        <minimal_quantity>0</minimal_quantity>
        <customizable>0</customizable>
        <text_fields>0</text_fields>
        <uploadable_files>0</uploadable_files>
        <available_for_order>1</available_for_order>
        <condition>new</condition>
        <show_price>1</show_price>
        <date_add>2016-08-10</date_add>
        <associations>
            <categories>
                <id>2</id>
            </categories>
        </associations>
        <link_rewrite>
            <language id="1">ciroprova</language>
        </link_rewrite>
    </product>
</prestashop>

 

immagine.thumb.png.0bf567917b24a157b9c966e1e6874911.png

Edited by Ciro Marciano (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...