Update Stock And Price
Partial update for price, cost, stock, and active status only. Send only the fields you want to change; others stay unchanged.
URL Parameters
| Parameter | Type | Description |
|---|---|---|
id | integer | Product ID |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
price | float | No | Sale price |
old_price | float | No | List price (alias: list_price) |
cost | float | No | Cost price |
doviz_price | float | No | Currency price |
doviz_old_price | float | No | Currency list price |
stock | integer | No | Stock quantity |
active | integer / bool | No | 1/0 or 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"
Sample Response (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
}
}