PATCH https://example.com/api/v1/products/{id}/quick

Stok ve Fiyat Güncelle

Yalnızca fiyat, maliyet, stok ve aktif durumu için kısmi güncelleme. Değiştirmek istediğiniz alanları gönderin; diğerleri aynı kalır.

URL Parametreleri

ParametreTipAçıklama
idintegerÜrün ID

Gövde Parametreleri

ParametreTipZorunluAçıklama
pricefloatHayırSatış fiyatı
old_pricefloatHayırListe fiyatı (takma ad: list_price)
costfloatHayırMaliyet fiyatı
doviz_pricefloatHayırDöviz fiyatı
doviz_old_pricefloatHayırDöviz liste fiyatı
stockintegerHayırStok miktarı
activeinteger / boolHayır1/0 veya true/false
PHP
<?php

$baseUrl = 'https://example.com/api/v1';
$apiKey  = 'YOUR_API_KEY';
$productId = 1;

function apiRequest(string $method, string $url, string $apiKey, ?array $data = null): array
{
    $ch = curl_init();
    $headers = [
        'X-API-Key: ' . trim($apiKey),
        'Accept: application/json',
    ];
    if ($data !== null) {
        $headers[] = 'Content-Type: application/json';
    }
    curl_setopt_array($ch, [
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => $method,
        CURLOPT_HTTPHEADER => $headers,
        CURLOPT_SSL_VERIFYPEER => true,
    ]);
    if ($data !== null) {
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
    }
    $response = curl_exec($ch);
    $httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $error = curl_error($ch);
    curl_close($ch);
    $decoded = json_decode((string) $response, true);
    return [
        'http_code' => $httpCode,
        'curl_error' => $error,
        'response' => is_array($decoded) ? $decoded : $response,
    ];
}

$payload = [
    'price' => 500,
    'old_price' => 600,
    'stock' => 10,
    'active' => 1,
];

$result = apiRequest(
    'PATCH',
    $baseUrl . '/products/' . (int) $productId . '/quick',
    $apiKey,
    $payload
);
print_r($result);
cURL
# Full quick update
curl -s -X PATCH \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"price":500,"old_price":600,"stock":10,"active":1}' \
  "https://example.com/api/v1/products/1/quick"

# Stock only
curl -s -X PATCH \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"stock":10}' \
  "https://example.com/api/v1/products/1/quick"
Örnek Yanıt (JSON)
{
  "success": true,
  "message": "Ürün hızlı güncellendi",
  "lang": "tr",
  "data": {
    "id": 1,
    "name": "Test Product",
    "price": 500,
    "old_price": 600,
    "stock": 10,
    "active": 1,
    "has_variations": true
  }
}