löschen Ich versuche, von commercetools API über HTTP-Anfrage zu löschen.Kann Produkt nicht von commercetools api
Im Anschluss ist mein Code:
$url = 'https://api.sphere.io/test/products/xxxx';
$params = json_encode(array('version'=>1));
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Bearer xxxx'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$res = curl_exec($curl);
$response = json_decode($res);
print_r($response);
Antwort vom Server:
stdClass Object ([statusCode] => 400 [message] => Missing version number [errors] => Array ([0] => stdClass Object ([code] => InvalidOperation [message] => Missing version number)))
Ich schicke Versionsnummer in params, aber immer noch Fehler. Bitte helfen Sie mir
Irgendwelche Vorschläge dazu. – Gowri