opony Posted November 17, 2022 Share Posted November 17, 2022 Hi, I have problem when I use delete via PrestaShopWebservice it return me HTTP status of 400. Where should I search the problem ? HTTP REQUEST HEADER DELETE /api/customers/3 HTTP/2 Host: www.moj-sklep.pl authorization: Basic xxxxxxxxxxxxxxxxxxxxx accept: */* HTTP RESPONSE HEADER HTTP/2 400 date: Thu, 17 Nov 2022 12:22:19 GMT content-type: text/html content-length: 577 access-control-allow-origin: * server: IdeaWebServer/5.0.0 PHP doesn't return any errors Prestashop version: 1.6.0.14 PHP version 8.1.5 and PHP 5.6.35 - the same problem Link to comment Share on other sites More sharing options...
opony Posted November 18, 2022 Author Share Posted November 18, 2022 (edited) When I use url from web browserhttps://www.moj-sklep.pl/api/products/325/?ps_method=DELETE&output_format=JSON everythig is ok. The product is deleted. Why it isn't work via PrestaShopWebservice. Simple code: try { $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $del = $webService->DELETE(array('resource' => 'products', 'id' => 325)); } catch (PrestaShopWebserviceException $ex) { echo '<br>Other error: <br />' . $ex->getMessage(); } Edited November 18, 2022 by opony (see edit history) Link to comment Share on other sites More sharing options...
JustJohn Posted November 18, 2022 Share Posted November 18, 2022 (edited) You've got /api/customers in the first post and /api/products in the second. What are you trying to delete? Also, how did you get Prestashop 1.6 to run on PHP 8.1? Edited November 18, 2022 by JustJohn (see edit history) Link to comment Share on other sites More sharing options...
opony Posted November 18, 2022 Author Share Posted November 18, 2022 As I wrote deleting doesn't work for customres, products, etc.... Engine of prestashop work at PHP 5.4, but WebService I have in local machine where I have PHP 8.1 I'm trying to delete products. Link to comment Share on other sites More sharing options...
JustJohn Posted November 18, 2022 Share Posted November 18, 2022 (edited) Ah my bad. I thought you were using REST with curl. Shouldn't "DEBUG" be instead "true" or "false"? Maybe remove "$del=" too. Edited November 18, 2022 by JustJohn (see edit history) Link to comment Share on other sites More sharing options...
opony Posted November 18, 2022 Author Share Posted November 18, 2022 1 hour ago, JustJohn said: Ah my bad. I thought you were using REST with curl. Shouldn't "DEBUG" be instead "true" or "false"? Maybe remove "$del=" too. "DEBUG" is define as constants. Link to comment Share on other sites More sharing options...
JustJohn Posted November 19, 2022 Share Posted November 19, 2022 Can't be of much help here, not enough PHP skills. Usually I just put everything in maximum debug mode including apache to try to coax out any meaningful information out of it. Using PHP curl is also one inelegant option that could work. 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