bendzius Posted November 2, 2013 Share Posted November 2, 2013 This is what i get after i try to insert new category, using web service: RETURN HTTP BODY<?xml version="1.0" encoding="UTF-8"?><prestashop xmlns:xlink="http://www.w3.org/1999/xlink"><errors><error><code><![CDATA[91]]></code><message><![CDATA[id is forbidden when adding a new resource]]></message></error></errors></prestashop>this is the resources im using:unset($resources ->position);unset($resources ->date_add);unset($resources ->date_upd);//unset($resources ->id_parent); //if unset category will be root. If set it must have id existing parent category!unset($resources ->level_depth);unset($resources ->nb_products_recursive);$resources ->id = '777';$resources ->id_parent = '118';$resources ->name ->language[0][0] = 'New Category Bla Bla';$resources ->link_rewrite->language[0][0] = 'New-category';$resources ->active = 1;$resources ->id_shop_default = 1;$resources ->is_root_category = 0; Is where a way to bypass this? I really need to insert my own ID`s Link to comment Share on other sites More sharing options...
PascalVG Posted November 2, 2013 Share Posted November 2, 2013 Field is an Auto-increment filed in the database. Would have to change this... pascal Link to comment Share on other sites More sharing options...
caponata_1 Posted November 25, 2013 Share Posted November 25, 2013 Field is an Auto-increment filed in the database. Would have to change this... pascal I've tryied this but it's not working, i think tha the webservice must be modifyed, any idea? Link to comment Share on other sites More sharing options...
urdin Posted December 17, 2013 Share Posted December 17, 2013 Hi bendzius, Did you find the solution to add your own ID's for new resources ( categories, suppliers, products,... ) ? Thanks in advance, César Link to comment Share on other sites More sharing options...
vekia Posted December 17, 2013 Share Posted December 17, 2013 ID fields are based on AUTO_INCREMENT attribute you can't add there own id because id is generated automatically while you adding new rows to the table. The AUTO_INCREMENT attribute can be used to generate a unique identity for new rows.No value was specified for the AUTO_INCREMENT column, so MySQL assigned sequence numbers automatically. Link to comment Share on other sites More sharing options...
edugasser Posted May 20, 2014 Share Posted May 20, 2014 You can modify the API of webservice. You must comment this lines of file WebserviceRequest.php /*elseif ($this->method == 'POST' && count($ids) > 0) { $this->setError(400, 'id is forbidden when adding a new resource', 91); return false; }*/ Edu Gasser. Link to comment Share on other sites More sharing options...
Maheshmohan1093 Posted August 7, 2015 Share Posted August 7, 2015 (edited) Hi, Found the solution. Please download these files and just upload it in the corresponding path. Then when inserting instead of id, put <id_product> along with other required parameters (name, price and link_rewrite) and then check the response, you would get 201 Created. However, take a backup of your database and files for safety. Now, you will be able to insert product id of your own in webservice. Enjoy! Mark this is solved if solved. Product.php WebserviceRequest.php Edited August 7, 2015 by Maheshmohan1093 (see edit history) Link to comment Share on other sites More sharing options...
rubenalb90 Posted July 27, 2016 Share Posted July 27, 2016 Hi, Found the solution. Please download these files and just upload it in the corresponding path. Then when inserting instead of id, put <id_product> along with other required parameters (name, price and link_rewrite) and then check the response, you would get 201 Created. However, take a backup of your database and files for safety. Now, you will be able to insert product id of your own in webservice. Enjoy! Mark this is solved if solved. Anything less extreme? I've been trying the method @edugasser commented and it didn't work. I also tried to change the auto_increment property of the id_product column, but it didn't work either. Any ideas? Kindest regards, 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