RestomarktRestomarkt

Restomarkt Geliştirici API

Ücretsiz REST API. Tedarikçiler ürün/stok ve siparişlerini yönetir; restoranlar sipariş oluşturup takip eder. Anahtarınızı panelden oluşturun: Tedarikçi →/tedarikci/api, Restoran → /restoran/api.

Kimlik doğrulama

Her isteğe API anahtarınızı Bearer olarak ekleyin:

curl https://restomarkt.com/api/v1/orders \
  -H "Authorization: Bearer rmk_live_xxxxxxxxxxxx"

Yetkiler (scope)

ScopeAçıklama
products:readÜrün kataloğunu okuma (tedarikçi)
products:writeStok/fiyat/aktiflik güncelleme (tedarikçi)
orders:readSiparişleri listeleme/görme
orders:writeSipariş oluşturma (restoran) / durum güncelleme (tedarikçi)

Tedarikçi uçları

GET /api/v1/productsproducts:read

Kendi ürün kataloğunuzun tamamı (ada göre sıralı). Sayfalama yoktur; tüm aktif/pasif ürünler döner.

Yanıt

{ "products": [
  {
    "id": "uuid",
    "name": "Klasik San Sebastian",
    "description": "10 dilim",
    "unit": "adet",            // adet | kg | koli | lt | paket
    "price": 1160,             // KDV hariç birim fiyat (₺)
    "stock": 25,               // null = sınırsız
    "min_order_qty": 1,
    "is_active": true,         // false = restoranlara görünmez
    "sold_count": 48,
    "group_id": 3              // komisyon grubu (global)
  }
] }

Örnek

curl https://restomarkt.com/api/v1/products \
  -H "Authorization: Bearer rmk_live_..."

PATCH /api/v1/products/:idproducts:write

Bir ürünün stoğunu, fiyatını veya satış durumunu güncelleyin. Yalnızca gönderdiğiniz alanlar değişir (en az bir alan zorunlu). Ürün size ait değilse 404 döner.

İstek gövdesi

{
  "stock": 40,         // sayı veya null (sınırsız)
  "price": 120,        // ≥ 0
  "is_active": true
}

Yanıt

{ "product": { "id": "uuid", "name": "...", "price": 120, "stock": 40, "is_active": true } }

Örnek

curl -X PATCH https://restomarkt.com/api/v1/products/PRODUCT_ID \
  -H "Authorization: Bearer rmk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"stock": 40}'

GET /api/v1/ordersorders:read

Size gelen siparişler (son 100, yeniden eskiye).

Yanıt

{ "orders": [
  {
    "id": "uuid",
    "status": "pending",        // pending|confirmed|preparing|shipped|delivered|cancelled
    "payment_method": "cari",   // cari | online
    "payment_status": "unpaid", // unpaid | paid | refunded
    "subtotal": 1740,
    "commission_total": 69.6,   // platform komisyonu
    "total": 1740,
    "created_at": "2026-06-10T08:30:00Z"
  }
] }

Örnek

curl https://restomarkt.com/api/v1/orders \
  -H "Authorization: Bearer rmk_live_..."

GET /api/v1/orders/:idorders:read

Tek siparişin durumu, ödeme bilgisi ve kalemleri.

Yanıt

{ "order": {
  "id": "uuid",
  "status": "preparing",
  "payment_method": "online",
  "payment_status": "paid",
  "subtotal": 1740,
  "commission_total": 69.6,
  "total": 1740,
  "delivery_address": "Çarşı Şube — Kocaeli/İzmit",
  "note": "Sabah teslim",
  "created_at": "2026-06-10T08:30:00Z",
  "order_items": [
    { "product_name": "Klasik San Sebastian", "unit": "adet", "qty": 1, "unit_price": 1160, "line_total": 1160 },
    { "product_name": "Lotus Cheesecake", "unit": "adet", "qty": 1, "unit_price": 900, "line_total": 900 }
  ]
} }

PATCH /api/v1/orders/:idorders:write

Sipariş durumunu bir adım ilerletin veya iptal edin. 'advance' geçerli sıradaki duruma geçirir (pending→confirmed→preparing→shipped→delivered); 'cancel' yalnızca pending/confirmed siparişlerde çalışır.

İstek gövdesi

{ "action": "advance" }   // veya { "action": "cancel" }

Yanıt

{ "id": "uuid", "status": "confirmed" }

Örnek

curl -X PATCH https://restomarkt.com/api/v1/orders/ORDER_ID \
  -H "Authorization: Bearer rmk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"action":"advance"}'

Restoran uçları

POST /api/v1/ordersorders:write

Tek bir tedarikçiye yeni sipariş oluşturur. Tüm ürünler aynı tedarikçiye ait olmalı. Sunucuda doğrulanır: tedarikçi onaylı mı, ödeme yöntemi kabul ediliyor mu, ürünler aktif mi, stok/min. sipariş yeterli mi. Hatalıysa 400 + açıklama döner.

İstek gövdesi

{
  "supplier_id": "uuid",            // zorunlu
  "payment_method": "cari",         // zorunlu: "cari" | "online"
  "delivery_address": "İzmit merkez",  // opsiyonel
  "note": "sabah teslim",           // opsiyonel
  "items": [                         // zorunlu, en az 1
    { "product_id": "uuid", "qty": 3 }
  ]
}

Yanıt

{ "order_id": "uuid" }   // HTTP 201

Örnek

curl -X POST https://restomarkt.com/api/v1/orders \
  -H "Authorization: Bearer rmk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "supplier_id": "SUPPLIER_ID",
    "payment_method": "cari",
    "items": [ { "product_id": "PRODUCT_ID", "qty": 3 } ]
  }'

GET /api/v1/ordersorders:read

Verdiğiniz siparişler (son 100, yeniden eskiye).

Yanıt

{ "orders": [
  { "id": "uuid", "status": "confirmed", "payment_method": "cari", "payment_status": "unpaid",
    "subtotal": 1740, "commission_total": 69.6, "total": 1740, "created_at": "2026-06-10T08:30:00Z" }
] }

Örnek

curl https://restomarkt.com/api/v1/orders \
  -H "Authorization: Bearer rmk_live_..."

GET /api/v1/orders/:idorders:read

Verdiğiniz tek siparişin durumu ve kalemleri (tedarikçideki ile aynı şema).

Yanıt

{ "order": {
  "id": "uuid", "status": "shipped", "payment_method": "cari", "payment_status": "unpaid",
  "subtotal": 1740, "commission_total": 69.6, "total": 1740,
  "delivery_address": "...", "note": "...", "created_at": "...",
  "order_items": [
    { "product_name": "Klasik San Sebastian", "unit": "adet", "qty": 1, "unit_price": 1160, "line_total": 1160 }
  ]
} }

Sipariş durumunu tedarikçi günceller; restoran anahtarı siparişi yalnızca okur. Ürünleri keşfetmek için mağaza/ürün sayfalarını veya web arayüzünü kullanın (genel ürün listeleme ucu yakında).

Hata kodları

KodAnlamı
401Geçersiz/eksik API anahtarı
403Yetki (scope) veya rol uyuşmazlığı
400Geçersiz istek (gövde, stok, min. sipariş, durum geçişi)
404Kayıt bulunamadı (size ait değil)

Hata yanıtı: { "error": "mesaj" }

  • API ücretsizdir; platform sipariş tutarına ek ücret koymaz.
  • Anahtarlar yalnızca oluşturulurken bir kez gösterilir.