razvy Posted June 21, 2016 Share Posted June 21, 2016 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 More sharing options...
roband Posted June 21, 2016 Share Posted June 21, 2016 Yes, the webservice API supports Create, Read, Update and Delete. It's documented here: http://doc.prestashop.com/display/PS16/Using+the+PrestaShop+Web+Service 1 Link to comment Share on other sites More sharing options...
razvy Posted June 22, 2016 Author Share Posted June 22, 2016 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? Link to comment Share on other sites More sharing options...
Rolige Posted June 29, 2016 Share Posted June 29, 2016 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 More sharing options...
hakeryk2 Posted August 21, 2017 Share Posted August 21, 2017 This is old topic but pretty much popular in Google so maybe someone will find those informations usefull -> https://www.prestashop.com/forums/topic/624317-example-of-jqueryjavascript-api-request-which-will-edit-something-in-order/ Link to comment Share on other sites More sharing options...
Globalis Posted November 24, 2018 Share Posted November 24, 2018 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 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now