API referansı · Ürünler
Kaynağın kategorilerini listele
Bir StockMount ürün kaynağında kullanılan kategori adlarını kimlikleriyle birlikte döndürür.
https://out.stockmount.com/api/Product/GetProductCategories
Kategoriler serbest metindir. AddProduct ve UpdateProduct, Category alanında kaynakta olmayan bir ad gönderdiğinizde bu kategoriyi otomatik oluşturur. API kategori silmez; bu yüzden listede artık hiçbir üründe kullanılmayan adlar da olabilir.
Ürün çağrıları kategori kimliğini değil adını bekler. ProductCategoryId yalnızca bilgi amaçlıdır; GetProducts içindeki ProductCategory filtresine de adı gönderirsiniz.
Liste ada göre sıralıdır ve sayfalanmaz. Yalnızca GetProductSources ile aldığınız kaynak kimliklerini gönderin.
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 oturum kodu.
|
ProductSourceId
zorunlu
|
integer |
StockMount tipindeki kaynak kimliği (GetProductSources). 1'den küçükse 00003 döner (ErrorMessage: ProductSourceId).
|
Yanıt alanları (Response)
| Alan | Tip | Açıklama |
|---|---|---|
ProductCategoryId
|
integer | Kategori kimliği (bilgi amaçlı). |
Name
|
string |
Kategori adı. Ürün çağrılarında Category olarak bu ad kullanılır.
|
Bu servisin hata kodları
| Kod | Ne zaman |
|---|---|
70002 |
ProductSourceId hesabınıza ait bir ürün kaynağı değil (ErrorMessage: InvalidProductSource). |
70018 |
Hesabınızda aktif Ürün Paketi yok (ErrorMessage: Ürün entegrasyonu için aktif Ürün Paketi gereklidir.). |
99999 |
Beklenmeyen bir hata oluştu. Kategori listesi okunamadığında da döner. |
Oturum hataları (00001, 00006) ve tüm kodlar için hata kodları.
İlgili servisler
Örnek istek
{
"ApiCode": "API_CODE",
"ProductSourceId": 1234
}
curl -X POST 'https://out.stockmount.com/api/Product/GetProductCategories' \
-H 'Content-Type: application/json' \
-d '{
"ApiCode": "API_CODE",
"ProductSourceId": 1234
}'
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
var json = """
{
"ApiCode": "API_CODE",
"ProductSourceId": 1234
}
""";
var response = await http.PostAsync(
"https://out.stockmount.com/api/Product/GetProductCategories",
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",
"ProductSourceId": 1234
}
JSON;
$ch = curl_init('https://out.stockmount.com/api/Product/GetProductCategories');
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",
"ProductSourceId": 1234
}
response = requests.post("https://out.stockmount.com/api/Product/GetProductCategories", json=payload, timeout=60)
result = response.json()
if not result["Result"]:
print(result["ErrorCode"], result["ErrorMessage"])
const payload = {
"ApiCode": "API_CODE",
"ProductSourceId": 1234
};
const response = await fetch("https://out.stockmount.com/api/Product/GetProductCategories", {
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": [
{
"ProductCategoryId": 55102,
"Name": "Pantolon"
},
{
"ProductCategoryId": 55101,
"Name": "Tişört"
}
]
}
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.
Son istekler
Bu sekmeden gönderdiğiniz son istekler; birine tıklayınca gövdesi yeniden yüklenir.