API referansı · Ürünler
Ürün kaynağı dosyasını yükle
Gönderdiğiniz ürün içeriğini (ör. XML) StockMount'taki ürün kaynağı adresinize dosya olarak yükler.
https://out.stockmount.com/api/Integration/SetProductSourceProducts
Aktif Ürün Paketi gerektirir; yoksa 70018 döner.
ProductSourceUrl yolu /{kullanıcıId}/out/{dosyaAdı} biçiminde olmalıdır. {kullanıcıId}, StockMount kullanıcı ID'nizin 8 haneye sıfırla doldurulmuş halidir (ör. 00012345). Alan adı kontrol edilmez. Biçim uymazsa 60501 döner.
ProductsText UTF-8 olarak /{kullanıcıId}/out/ klasörüne, URL'deki dosya adıyla yazılır. İçerik doğrulanmaz. Başarıda Response boştur.
Hata mesajları tutarsızdır: URL biçimi hatalı olduğunda da ErrorMessage ProductsText döner. Kodu (60501) esas alın.
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 |
DoLogin ile aldığınız API kodu.
|
ProductSourceUrl
zorunlu
|
string |
Ürün kaynağı dosyasının adresi; yol /{8 haneli kullanıcıId}/out/{dosyaAdı}.
|
ProductsText
zorunlu
|
string | Dosyanın tam içeriği (ör. XML metni). |
Yanıt alanları (Response)
Başarılı çağrıda Response alanı boş döner; sonucu Result alanından okuyun.
Bu servisin hata kodları
| Kod | Ne zaman |
|---|---|
60501 |
ProductSourceUrl yolu kullanıcı klasörüyle (/{kullanıcıId}/out/…) eşleşmiyor ya da kullanıcı klasörü oluşturulamadı. |
60502 |
out klasörü oluşturulamadı. |
60503 |
Dosya yüklenemedi. |
70018 |
Aktif Ürün Paketi yok. |
99999 |
Beklenmeyen hata. |
Oturum hataları (00001, 00006) ve tüm kodlar için hata kodları.
Örnek istek
{
"ApiCode": "API_CODE",
"ProductSourceUrl": "https://files.example.com/00012345/out/products.xml",
"ProductsText": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Products><Product><Code>KUPA-350</Code><Name>Seramik Kupa 350 ml</Name><Price>129.90</Price><Quantity>40</Quantity></Product></Products>"
}
curl -X POST 'https://out.stockmount.com/api/Integration/SetProductSourceProducts' \
-H 'Content-Type: application/json' \
-d '{
"ApiCode": "API_CODE",
"ProductSourceUrl": "https://files.example.com/00012345/out/products.xml",
"ProductsText": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Products><Product><Code>KUPA-350</Code><Name>Seramik Kupa 350 ml</Name><Price>129.90</Price><Quantity>40</Quantity></Product></Products>"
}'
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
var json = """
{
"ApiCode": "API_CODE",
"ProductSourceUrl": "https://files.example.com/00012345/out/products.xml",
"ProductsText": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Products><Product><Code>KUPA-350</Code><Name>Seramik Kupa 350 ml</Name><Price>129.90</Price><Quantity>40</Quantity></Product></Products>"
}
""";
var response = await http.PostAsync(
"https://out.stockmount.com/api/Integration/SetProductSourceProducts",
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",
"ProductSourceUrl": "https://files.example.com/00012345/out/products.xml",
"ProductsText": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Products><Product><Code>KUPA-350</Code><Name>Seramik Kupa 350 ml</Name><Price>129.90</Price><Quantity>40</Quantity></Product></Products>"
}
JSON;
$ch = curl_init('https://out.stockmount.com/api/Integration/SetProductSourceProducts');
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",
"ProductSourceUrl": "https://files.example.com/00012345/out/products.xml",
"ProductsText": "\u003C?xml version=\u00221.0\u0022 encoding=\u0022UTF-8\u0022?\u003E\u003CProducts\u003E\u003CProduct\u003E\u003CCode\u003EKUPA-350\u003C/Code\u003E\u003CName\u003ESeramik Kupa 350 ml\u003C/Name\u003E\u003CPrice\u003E129.90\u003C/Price\u003E\u003CQuantity\u003E40\u003C/Quantity\u003E\u003C/Product\u003E\u003C/Products\u003E"
}
response = requests.post("https://out.stockmount.com/api/Integration/SetProductSourceProducts", json=payload, timeout=60)
result = response.json()
if not result["Result"]:
print(result["ErrorCode"], result["ErrorMessage"])
const payload = {
"ApiCode": "API_CODE",
"ProductSourceUrl": "https://files.example.com/00012345/out/products.xml",
"ProductsText": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Products><Product><Code>KUPA-350</Code><Name>Seramik Kupa 350 ml</Name><Price>129.90</Price><Quantity>40</Quantity></Product></Products>"
};
const response = await fetch("https://out.stockmount.com/api/Integration/SetProductSourceProducts", {
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
}
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.