Mam problem z REST API od allegro.
Zasadniczo połączyłem się z allegro i jestem w stanie pobierać dane swoich aukcji, kategorii, parametrów itp.
Ale próbuje teraz stworzyć draft oferty i mam z tym problem
oto co robię:
$zapytanie = "https://api.allegro.pl/sale/offers"; $ch = curl_init($zapytanie); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer $token", "Accept: application/vnd.allegro.public.v1+json", "Content-Type: application/vnd.allegro.public.v1+json", ]); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, 'name' => 'testowy1234a', 'ean' => '12312312333323' )) ); $result = curl_exec($ch); $resultCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($result === false || $resultCode !== 200) { } $wynik = json_decode($result); return $wynik;
W dokumentacji https://developer.allegro.pl/documentation/...CommandUsingPUT
pisze że wymagane jest tylko pole name (max 50 znaków), a resztę można uzupełnić potem.
Po wywołaniu tego zapytania, wywala mi błąd:
stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [code] => ERROR [message] => An error has occurred [details] => [path] => /sale/offers [userMessage] => ) ) ) 1
P.S robie to na localhoscie z Xampp o ile to ma jakieś znaczenie
Ma ktoś jakiś pomysł? Z góry dziękuje