Jump to content

Update stock with API through URL


razvy

Recommended Posts

Hi,

 

I've just learned that there is an web service for Prestashop.

By activating it and typing simple URLs in the browser, you can extract any information from the database (with an API key that acts like a password, of course).

 

For example, if you access the following URL: [email protected]/InstallationDirectory/api/products/ProductID you can see the details of the product with the ProductID, in the form of an XML table.

 

Also, if you access a similar URL, [email protected]/InstallationDirectory/api/stock_availables/StockID/, you can get the stock quantity for the StockID, wich is related to a product. Here is the result:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<script/>
<stock_available>
<id>
<![CDATA[ 46318 ]]>
</id>
<id_product xlink:href="http://www.yourstore.com/api/products/116904">
<![CDATA[ 116904 ]]>
</id_product>
<id_product_attribute>
<![CDATA[ 0 ]]>
</id_product_attribute>
<id_shop xlink:href="http://www.yourstore.com/api/shops/1">
<![CDATA[ 1 ]]>
</id_shop>
<id_shop_group>
<![CDATA[ 0 ]]>
</id_shop_group>
<quantity>
<![CDATA[ 1577 ]]>
</quantity>
<depends_on_stock>
<![CDATA[ 0 ]]>
</depends_on_stock>
<out_of_stock>
<![CDATA[ 0 ]]>
</out_of_stock>
</stock_available>
</prestashop>

Now, here comes the question:

 

Does anyone know how you can UPDATE the stock quantity and the status of a product by accessing an URL or two?

 

Thanks!

 

 

Link to comment
Share on other sites

I know, but I'm not that good with programming...

 

Could anyone show me the URL for updating the stock and status of a product?

Maybe you are waiting for an URL of example to do this, but INSERT (POST) and UPDATE (PUT) I think should be through a file, here some examples provided by PrestaShop:

 

https://github.com/PrestaShop/PrestaShop-webservice-lib/tree/master/examples

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

Hello, did you solve this problem, because I have the same needs, I would like to update stock quantity of a product according to its "reference" (my reference on my catalog) and not its ps_product_ID, and I would like to do it from an URL including API key, reference code and quantity to update

  • Thanks 1
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...