API referansı · Ürünler
Varyant stoğunu barkodla güncelle
Code ve ProductSourceId ile bulunan ürünün stoğunu ve varyantlarını barkodla eşleştirerek varyant stoklarını günceller.
https://out.stockmount.com/api/Product/UpdateProductQuantityByBarcode
Her çağrı tek bir ürünü günceller; birden fazla ürünü aynı çağrıda gönderemezsiniz. Bir ürünün birden fazla varyantını Variants ile aynı çağrıda güncelleyebilirsiniz.
Ürün barkodla değil, Code + ProductSourceId ile bulunur; ProductId yok sayılır. Kök düzeydeki Barcode alanı kullanılmaz. Barkod yalnızca Variants içindeki varyantları eşleştirmek için kullanılır.
Variants içindeki her öğe ProductVariantId ile, bu yoksa Barcode ile bu ürünün varyantlarıyla eşleştirilir. Eşleşen varyantın stoğu Quantity ile değiştirilir (gönderilmezse 0). Listede olmayan varyantlara dokunulmaz.
Gönderdiğiniz miktar ürünün satılabilir stoğunun yerine geçer; StockMount'un o ana kadar saydığı satılan adet sıfırlanır. Yeni ürün stoğu 1'den küçükse ürünün Status değeri 3, aksi halde 2 olur.
Ürün düzeyindeki Quantity her çağrıda yazılır. Quantity göndermeden yalnızca varyant stoklarını gönderirseniz ve SetProductQuantityFromVariants alanını true yapmazsanız ürün stoğu 0 olur. Varyantlı ürünlerde SetProductQuantityFromVariants: true göndermeniz önerilir.
Dikkat: Bu uç nokta, stok güncellemesi olmasına rağmen ürünün Price2–Price5 alanlarını istekteki değerle değiştirir; göndermezseniz bu fiyatlar 0 olur. Bu fiyatları kullanıyorsanız mevcut değerlerini her çağrıda gönderin. Price ve MarketPrice değişmez.
CurrencyId bu uç noktada yok sayılır; ürünün para birimi değişmez.
Miktarlar doğrulanmaz; negatif değerler reddedilmez.
Başarılı her çağrıdan sonra, ürünün pazaryerlerindeki aktif ilanları için stok güncellemesi kuyruğa alınır (aynı tür bekleyen güncelleme yoksa). Pazaryerleri bu çağrı sırasında değil, arka plandaki işlerle güncellenir.
Ürün bulunamazsa veya hesabınıza ait değilse yanıt Result: false, ErrorCode: "70005" ve ErrorMessage: "ProductNotFound" olur. Veritabanı hatalarında ErrorCode 99999 olur.
Aktif Ürün Paketi olmayan hesaplar 70018 hatası alır; paket bilgisi doğrulanamazsa 99999 döner.
İstek alanları
| Alan | Tip | Açıklama |
|---|---|---|
ApiCode
zorunlu
|
string |
User/DoLogin ile aldığınız API anahtarı.
|
Code
zorunlu
|
string |
Ürün kodu (stok kodu), en fazla 50 karakter. Ürün, Code ve ProductSourceId birlikte kullanılarak bulunur. Bu uç noktada ProductId yok sayılır.
|
ProductSourceId
zorunlu
|
integer |
Ürünün bağlı olduğu ürün kaynağının kimliği (GetProductSources). Code bu kaynak içinde aranır.
|
Quantity
|
integer |
Ürünün yeni stok miktarı. Gönderilmezse 0 yazılır. SetProductQuantityFromVariants true ise ve Variants en az bir öğe içeriyorsa yok sayılır. Negatif değer reddedilmez.
|
SetProductQuantityFromVariants
|
boolean |
true ise ürün stoğu varyantların toplamı olarak hesaplanır: listede gönderdiğiniz aktif varyantlar için yeni miktar, diğer tüm varyantlar (pasifler dahil) için mevcut satılabilir stok kullanılır. Variants boşsa etkisizdir. Varsayılan false.
|
Price2
|
number |
Ürünün ek fiyatı 2. Bu uç nokta stok güncellese de bu alanı ürüne yazar; gönderilmezse 0 olur. Mevcut değeri gönderin.
|
Price3
|
number |
Ürünün ek fiyatı 3. Bu uç nokta stok güncellese de bu alanı ürüne yazar; gönderilmezse 0 olur. Mevcut değeri gönderin.
|
Price4
|
number |
Ürünün ek fiyatı 4. Bu uç nokta stok güncellese de bu alanı ürüne yazar; gönderilmezse 0 olur. Mevcut değeri gönderin.
|
Price5
|
number |
Ürünün ek fiyatı 5. Bu uç nokta stok güncellese de bu alanı ürüne yazar; gönderilmezse 0 olur. Mevcut değeri gönderin.
|
Variants
|
object[] | Güncellenecek varyantlar. Yalnızca listedeki varyantlar değişir; eşleşmeyen öğeler hata vermeden atlanır. |
Variants[].
ProductVariantId
|
integer |
Varyant kimliği. Gönderilmezse veya 0 ise varyant Barcode ile bulunur.
|
Variants[].
Barcode
|
string |
Varyant barkodu. ProductVariantId yoksa varyant bu barkodla, yalnızca bu ürünün varyantları içinde aranır. Baştaki ve sondaki boşluklar silinir.
|
Variants[].
Quantity
|
integer |
Varyantın yeni stok miktarı. Gönderilmezse 0 yazılır. Negatif değer reddedilmez.
|
Yanıt alanları (Response)
| Alan | Tip | Açıklama |
|---|---|---|
ProductId
|
integer | Güncellenen ürünün kimliği. |
Variants
|
object[] | Bu çağrıda güncellenen varyantlar. Varyant göndermediyseniz boş dizi döner. |
Variants[].
Code
|
string | Varyant kodu. |
Variants[].
ProductVariantId
|
integer | Varyant kimliği. |
Bu servisin hata kodları
| Kod | Ne zaman |
|---|---|
70005 |
Ürün bulunamadı veya hesabınıza ait değil (ErrorMessage: ProductNotFound). |
00003 |
Code boş (ErrorMessage: "ProductId") veya ProductSourceId 1'den küçük (ErrorMessage: "ProductSourceId"). |
70018 |
Hesabınızda aktif Ürün Paketi yok. |
99999 |
Beklenmeyen bir sunucu hatası oluştu. |
Oturum hataları (00001, 00006) ve tüm kodlar için hata kodları.
İlgili servisler
Örnek istek
{
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"SetProductQuantityFromVariants": true,
"Price2": 329.9,
"Price3": 0,
"Price4": 0,
"Price5": 0,
"Variants": [
{
"Barcode": "8690000000017",
"Quantity": 15
},
{
"Barcode": "8690000000024",
"Quantity": 0
}
]
}
curl -X POST 'https://out.stockmount.com/api/Product/UpdateProductQuantityByBarcode' \
-H 'Content-Type: application/json' \
-d '{
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"SetProductQuantityFromVariants": true,
"Price2": 329.9,
"Price3": 0,
"Price4": 0,
"Price5": 0,
"Variants": [
{
"Barcode": "8690000000017",
"Quantity": 15
},
{
"Barcode": "8690000000024",
"Quantity": 0
}
]
}'
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
var json = """
{
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"SetProductQuantityFromVariants": true,
"Price2": 329.9,
"Price3": 0,
"Price4": 0,
"Price5": 0,
"Variants": [
{
"Barcode": "8690000000017",
"Quantity": 15
},
{
"Barcode": "8690000000024",
"Quantity": 0
}
]
}
""";
var response = await http.PostAsync(
"https://out.stockmount.com/api/Product/UpdateProductQuantityByBarcode",
new StringContent(json, Encoding.UTF8, "application/json"));
var result = await response.Content.ReadAsStringAsync();
// Result == false ise ErrorCode ve ErrorMessage alanlarına bakın.
Console.WriteLine(result);
<?php
$body = <<<'JSON'
{
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"SetProductQuantityFromVariants": true,
"Price2": 329.9,
"Price3": 0,
"Price4": 0,
"Price5": 0,
"Variants": [
{
"Barcode": "8690000000017",
"Quantity": 15
},
{
"Barcode": "8690000000024",
"Quantity": 0
}
]
}
JSON;
$ch = curl_init('https://out.stockmount.com/api/Product/UpdateProductQuantityByBarcode');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$result['Result']) {
echo $result['ErrorCode'] . ' ' . $result['ErrorMessage'];
}
import requests
payload = {
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"SetProductQuantityFromVariants": True,
"Price2": 329.9,
"Price3": 0,
"Price4": 0,
"Price5": 0,
"Variants": [
{
"Barcode": "8690000000017",
"Quantity": 15
},
{
"Barcode": "8690000000024",
"Quantity": 0
}
]
}
response = requests.post("https://out.stockmount.com/api/Product/UpdateProductQuantityByBarcode", json=payload, timeout=60)
result = response.json()
if not result["Result"]:
print(result["ErrorCode"], result["ErrorMessage"])
const payload = {
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"SetProductQuantityFromVariants": true,
"Price2": 329.9,
"Price3": 0,
"Price4": 0,
"Price5": 0,
"Variants": [
{
"Barcode": "8690000000017",
"Quantity": 15
},
{
"Barcode": "8690000000024",
"Quantity": 0
}
]
};
const response = await fetch("https://out.stockmount.com/api/Product/UpdateProductQuantityByBarcode", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
const result = await response.json();
if (!result.Result) {
console.error(result.ErrorCode, result.ErrorMessage);
}
Örnek yanıt
{
"Result": true,
"Response": {
"ProductId": 184522,
"Variants": [
{
"Code": "TSHIRT-RED-M",
"ProductVariantId": 9120344
},
{
"Code": "TSHIRT-RED-L",
"ProductVariantId": 9120345
}
]
}
}
Deneyin
İstek tarayıcınızdan doğrudan out.stockmount.com adresine gider. ApiCode bu sitede saklanmaz; yalnızca bu sekme açıkken tutulur.
İstek göndermek için önce ApiCode alın.
Bu servis hesabınızdaki gerçek verileri değiştirir.
Son istekler
Bu sekmeden gönderdiğiniz son istekler; birine tıklayınca gövdesi yeniden yüklenir.