Jump to content

HTTP status of 400 - PrestaShopWebservice DELETE


opony

Recommended Posts

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

When I use url from web browser
https://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 by opony (see edit history)
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...