encodia Posted January 22, 2013 Share Posted January 22, 2013 I'm trying to update my products via web service (Prestashop 1.5.3.1). I downloaded the PSWebServiceLibrary.php file and run the examples; after changing const psCompatibleVersionsMax to make it run with 1.5.3.1, I could run the examples. I can read customers or products, but if I try to update one of them, I get a 400 error (Bad Request). HTTP REQUEST HEADER PUT /api/products/2 HTTP/1.1 Authorization: Basic RU5DUEhUUlZSR1hYR0xWVzFIM1QySFAyUjU4OEc0UTM6 Host: test.dev.loc Accept: */* Content-Length: 2474 Content-Type: application/x-www-form-urlencoded HTTP RESPONSE HEADER HTTP/1.1 400 Bad Request Date: Tue, 22 Jan 2013 21:50:31 GMT Server: Apache/2.2.22 (Unix) PHP/5.3.15 with Suhosin-Patch mod_ssl/2.2.22 OpenSSL/0.9.8r Vary: Authorization,Host X-Powered-By: PrestaShop Webservice Access-Time: 1358891431 PSWS-Version: 1.5.3.1 Execution-Time: 0.042 Set-Cookie: 3f99a2f33f7744ef0eca694ec6b1a644=MnNQK7%2BX8pQ%3DC%2FhkeW%2BSG98%3DeyWwe7MJMlE%3DJ82miKhnG%2Fg%3DFIUDljOoQlM%3DwCzdLGjYgV0%3D%2FzkZbA2Oumw%3DfAZdr7Dh2AA%3D000060; expires=Mon, 11-Feb-2013 21:50:31 GMT; path=/; domain=test.dev.loc; httponly Content-Length: 241 Connection: close Content-Type: text/xml;charset=utf-8 RETURN HTTP BODY <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <message><![CDATA[internal error. To see this error please display the PHP errors.]]></message> </error> </errors> </prestashop> What is the problem? Is there another way to update products? I need to change prices with a batch process. Thank you Link to comment Share on other sites More sharing options...
encodia Posted January 23, 2013 Author Share Posted January 23, 2013 Apache error logs doesn't report anything concerning this error. Link to comment Share on other sites More sharing options...
encodia Posted January 23, 2013 Author Share Posted January 23, 2013 No one experiencing this problem? Searching on Google there are a lot of questions / bug tracking about this problem, but I couldn't find any solution... Thanks in advance to whoever can tell me anything about this error. Link to comment Share on other sites More sharing options...
encodia Posted January 23, 2013 Author Share Posted January 23, 2013 Solved. After enabling 'display_error' in defines.inc.php, the PUT response shows that some field cannot be updated, so it has to be removed from the XML. Link to comment Share on other sites More sharing options...
jayesh_akbari Posted April 16, 2013 Share Posted April 16, 2013 I'm trying to update my products via web service (Prestashop 1.5.3.1). I downloaded the PSWebServiceLibrary.php file and run the examples; after changing const psCompatibleVersionsMax to make it run with 1.5.3.1, I could run the examples. I can read customers or products, but if I try to update one of them, I get a 400 error (Bad Request). HTTP REQUEST HEADER PUT /api/products/2 HTTP/1.1 Authorization: Basic RU5DUEhUUlZSR1hYR0xWVzFIM1QySFAyUjU4OEc0UTM6 Host: test.dev.loc Accept: */* Content-Length: 2474 Content-Type: application/x-www-form-urlencoded HTTP RESPONSE HEADER HTTP/1.1 400 Bad Request Date: Tue, 22 Jan 2013 21:50:31 GMT Server: Apache/2.2.22 (Unix) PHP/5.3.15 with Suhosin-Patch mod_ssl/2.2.22 OpenSSL/0.9.8r Vary: Authorization,Host X-Powered-By: PrestaShop Webservice Access-Time: 1358891431 PSWS-Version: 1.5.3.1 Execution-Time: 0.042 Set-Cookie: 3f99a2f33f7744ef0eca694ec6b1a644=MnNQK7%2BX8pQ%3DC%2FhkeW%2BSG98%3DeyWwe7MJMlE%3DJ82miKhnG%2Fg%3DFIUDljOoQlM%3DwCzdLGjYgV0%3D%2FzkZbA2Oumw%3DfAZdr7Dh2AA%3D000060; expires=Mon, 11-Feb-2013 21:50:31 GMT; path=/; domain=test.dev.loc; httponly Content-Length: 241 Connection: close Content-Type: text/xml;charset=utf-8 RETURN HTTP BODY <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <message><![CDATA[internal error. To see this error please display the PHP errors.]]></message> </error> </errors> </prestashop> What is the problem? Is there another way to update products? I need to change prices with a batch process. Thank you Hi there i also downloaded the PSWebServiceLibrary.php but i still get nothing in 1.5.3 can you please help me out and tell me what are the steps or pre requisite to run the web service . what i get is 302 error. Link to comment Share on other sites More sharing options...
mohrt Posted July 31, 2014 Share Posted July 31, 2014 (edited) I had the same issue with updating a product through PSWebServiceLibrary.php, here was the problem: <message><![CDATA[parameter "position_in_category" not writable. Please remove this attribute of this XML]]></message> If you enable debug on the library it gives you the HTTP responses required to track down the issue. Edited July 31, 2014 by mohrt (see edit history) Link to comment Share on other sites More sharing options...
jose.fantasia Posted September 11, 2014 Share Posted September 11, 2014 Same issue here. Using version 1.6 but in this case, by eliminating "postion_in_category" parameter, the error is still happening. Is there any way to find out if any other paramater is causing this issue? Thanks !! Link to comment Share on other sites More sharing options...
joelPresta Posted October 28, 2014 Share Posted October 28, 2014 Thanks for the solution! Running PS 1.6.0.9 here and had to remove the parameters "manufacturer_name" and "quantity"... PS: I changed PS to debug mode in defines.inc.php: define('_PS_MODE_DEV_', true); 1 Link to comment Share on other sites More sharing options...
stefan2 Posted May 29, 2015 Share Posted May 29, 2015 (edited) same problem here (ps 1.6.0.14) _PS_MODE_DEV_ = true not helping I PUT very simple XML to change "active" only: <?xml version="1.0" encoding="UTF-8"?><prestashop xmlns:xlink="http://www.w3.org/1999/xlink"><product><id>115880</id><active>0</active></product></prestashop> and still have: HTTP RESPONSE HEADER HTTP/1.1 400 Bad Request There is all OK with update the customer (with example file) but not with products. Edited May 29, 2015 by stefan2 (see edit history) Link to comment Share on other sites More sharing options...
davidemaglio Posted September 10, 2015 Share Posted September 10, 2015 solved? i have the same issue.... Link to comment Share on other sites More sharing options...
fuegonju Posted October 18, 2015 Share Posted October 18, 2015 Thanks for the solution! Running PS 1.6.0.9 here and had to remove the parameters "manufacturer_name" and "quantity"... PS: I changed PS to debug mode in defines.inc.php: define('_PS_MODE_DEV_', true); It works! Thanks JoelPresta, you save my day! ;-) Link to comment Share on other sites More sharing options...
Ytopic Posted December 12, 2017 Share Posted December 12, 2017 I didn't know how to see the error. At the xml information you will see at the end the error information. Thanks for the solution! 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