Jump to content

HTTP status of 400 - PrestaShopWebservice


opony

Recommended Posts

Cześć, podczas usuwania (produktu, klienta, czegokolwiek ) otrzymuję HTTP status of 400.
Get działa bez problemu. 

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 nie zwraca błędów. Gdzie szukać przyczyny ?

 

Wersja Presty 1.6.0.14

PHP 8.1.5

Edited by opony (see edit history)
Link to comment
Share on other sites

Kiedy używam adresu www bezpośrednio z przeglądarki
https://www.moj-sklep.pl/api/products/325/?ps_method=DELETE&output_format=JSON

wszystko działa. Produkt jest usuwany. Dlaczego to samo nie działa przez PrestaShopWebservice. Prosty kod:

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();
}

 

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...