REST API ile stok verilerinize programatik erişim sağlayın.
Tüm API isteklerinde Authorization header'ı ile API anahtarınızı gönderin.
Authorization: Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxx
API anahtarlarınızı Dashboard → API Anahtarları bölümünden yönetebilirsiniz.
https://stokdurumu.com/api/v1
| Plan | İstek/Gün |
|---|---|
| Free | 500 |
| Basic | 5.000 |
| Pro | 50.000 |
| Enterprise | Sınırsız |
Limit aşıldığında 429 Too Many Requests döner. Gece yarısı UTC+3 sıfırlanır.
/productsÜrünleri listele
Query Parametreleri
| Parametre | Tip | Açıklama |
|---|---|---|
page | integer | Sayfa numarası (varsayılan: 1) |
limit | integer | Sayfa başına kayıt (maks: 100, varsayılan: 20) |
q | string | İsme göre arama |
sku | string | SKU ile filtrele |
status | string | active / inactive |
low_stock | boolean | Sadece düşük stoklu ürünler |
curl -X GET "https://stokdurumu.com/api/v1/products?page=1&limit=20" \
-H "Authorization: Bearer sk_xxxx"
Yanıt
{
"products": [
{
"id": 1,
"name": "Laptop Çantası",
"sku": "LPC-001",
"category": "Aksesuar",
"price": "299.90",
"stock_qty": 47,
"min_stock": 5,
"unit": "adet",
"status": "active",
"updated_at": "2024-01-15 14:30:00"
}
],
"meta": {
"total": 150,
"page": 1,
"limit": 20,
"pages": 8
}
}
/products/{id}Tekil ürün getir
curl -X GET "https://stokdurumu.com/api/v1/products/42" \
-H "Authorization: Bearer sk_xxxx"
/products writeYeni ürün oluştur
Request Body
| Alan | Tip | Zorunlu | Açıklama |
|---|---|---|---|
name | string | ✓ | Ürün adı |
sku | string | Stok kodu | |
price | number | Fiyat | |
stock_qty | integer | Başlangıç stok | |
min_stock | integer | Minimum stok uyarı eşiği | |
category_id | integer | Kategori ID | |
unit | string | adet, kg, lt, m... |
curl -X POST "https://stokdurumu.com/api/v1/products" \
-H "Authorization: Bearer sk_xxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Laptop Çantası",
"sku": "LPC-001",
"price": 299.90,
"stock_qty": 50,
"min_stock": 5,
"unit": "adet"
}'
/products/{id} writeÜrün güncelle
curl -X PUT "https://stokdurumu.com/api/v1/products/42" \
-H "Authorization: Bearer sk_xxxx" \
-H "Content-Type: application/json" \
-d '{"price": 349.90, "status": "active"}'
/products/{id} deleteÜrün sil
curl -X DELETE "https://stokdurumu.com/api/v1/products/42" \
-H "Authorization: Bearer sk_xxxx"
/stock writeStok miktarını güncelle
| Alan | Açıklama |
|---|---|
product_id | Ürün ID (zorunlu) |
action | add ekle / sub çıkar / set ayarla |
qty | Miktar (zorunlu, ≥0) |
reason | Açıklama (opsiyonel) |
curl -X POST "https://stokdurumu.com/api/v1/stock" \
-H "Authorization: Bearer sk_xxxx" \
-H "Content-Type: application/json" \
-d '{
"product_id": 42,
"action": "sub",
"qty": 3,
"reason": "Satış - Sipariş #1234"
}'
Yanıt
{
"success": true,
"product_id": 42,
"action": "sub",
"old_qty": 47,
"new_qty": 44,
"change_qty": -3
}
/stockStok geçmişini getir
curl "https://stokdurumu.com/api/v1/stock?product_id=42&limit=10" \
-H "Authorization: Bearer sk_xxxx"
/categoriescurl "https://stokdurumu.com/api/v1/categories" -H "Authorization: Bearer sk_xxxx"
/categoriescurl -X POST "https://stokdurumu.com/api/v1/categories" \
-H "Authorization: Bearer sk_xxxx" \
-H "Content-Type: application/json" \
-d '{"name": "Elektronik", "color": "#0d6efd"}'
| Kod | Anlam |
|---|---|
200 | Başarılı |
201 | Oluşturuldu |
400 | Geçersiz istek |
401 | Yetkisiz — API anahtarı gerekli |
402 | Plan limiti aşıldı |
403 | Bu işlem için izin yok |
404 | Kayıt bulunamadı |
422 | Doğrulama hatası |
429 | Rate limit aşıldı |
500 | Sunucu hatası |
Tüm hata yanıtları: {"error": "Hata mesajı"}