boolxy / trendyol

Trendyol API Client Library for PHP
MIT License
35 stars 12 forks source link

createProduct - 400 Bad Request #18

Open erdikoroglu opened 2 years ago

erdikoroglu commented 2 years ago

Client error: "POST https://api.trendyol.com/sapigw/suppliers/--MAGAZAID--/v2/products" resulted in a "400 Bad Request" response: {"timestamp":1636202783839,"exception":"ClientApiBusinessException","errors":[{}]}

Olarak hata döndürüyor.

env dosyasına URL ekledim. Sonuç aynı. Ayrıca laravel 8 için composer gereksinimlerini güncellersen sevinirim.

erdikoroglu commented 2 years ago

`$data = TrendyolProduct::find(1); $json = burada_json data mevcut'; $conv = json_decode($json,true); ->> array çevirdim

$product = new Product($conv); -> model gonderdım $result = Trendyol::create('KEY','SECRET','SUPPLIER') ->productService() ->creatingProducts(); $result->addProduct($product); $service = $result->create(); return response()->json($service);`

hata var mı ?

erdikoroglu commented 2 years ago

$response = $this->client->$method($path, [ RequestOptions::SYNCHRONOUS => false, RequestOptions::HEADERS => [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36' ], RequestOptions::JSON => $data, RequestOptions::MULTIPART => $multipart, ]);

User Agent ekledım ama kontrol ettiğimde. "headers" => array:1 [▼ "User-Agent" => "GuzzleHttp/7" ]

olarak çıktı veriyor.