public function sendProduct($product)
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.trendyol.com/sapigw/suppliers/MAGAZA-KODU/v2/products',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $product,
CURLOPT_HTTPHEADER => array(
'Authorization: Basic Rm04c2xhNFFsTmpzanV6alZhVlY6dmRCWTduekwyejNqUDRSTkZFTkc=',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
return $response;Bu fonksiyon ile Örnek Harddisk kategorisine ürün gönderdiğimde sorunsuz yuklenıyor.
Lakin Dizüstü bilgisayar kategorisine geldiğimde yükleme yapmıyor.
"{"timestamp":1636458354348,"exception":"ClientApiBusinessException","errors":[{}]}"detayları olmayan bu hata exeption dönüyor. Dökümanda bu Exception hakkında hiç birşey yok.
------------------------------------------ ÇÖZÜMÜ -------------------------------------------
{
[B]"allowCustom": true,[/B]
"attribute": {
"id": 47,
"name": "Renk"
},
"attributeValues": [],
"categoryId": 429,
"required": true,
"varianter": false,
"slicer": true
}Kategori özelliklerinde
allowCustom değeri
true ise göndereceğiniz değer kısmında
attributeValueId değeri yerine
customAttributeValue olarak gönderin.
Sorun bundan ibaret.