GET /plugin-api/tables/get ✓ Canlıtable.close gate'i yalnızca bir referans taşır (target:{type:'table', id:'…'}); masanın DOLU içeriğini (ürünler, tutar, müşteri) bu uçtan, o id ile çekersiniz. Paket karşılığı packets/get ile aynı şekil/mapping'tir.
← API Uçları · ortak kurallar (base, auth, hata zarfı) orada.
GET {RESTOMENUM_BASE}/plugin-api/tables/get?id=<encodeURIComponent(target.id)>
Authorization: Bearer <apiKey> // kurulumdaki (OAuth exchange) install API key{RESTOMENUM_BASE}): ortama göre — Sandbox https://sandbox.plugins.restomenum.app, Production https://plugins.restomenum.app (tüm liste: API Uçları).Authorization: Bearer <apiKey> — kurulumda OAuth token exchange'te aldığın apiKey.orders:read zorunlu (yoksa plugin.scope.denied).target.id URL-encoded olabilir (örn. bah%C3%A7e1 — Türkçe ç yüzünden). Query'de mutlaka encodeURIComponent(target.id) kullan; yoksa çift-decode olur → plugin.tables.notFound.Paket karşılığı packets/get ile aynı kanonik desendedir (envelope { success, data } + temiz orders[]). Canlı örnek (gerçek masa Bahçe1):
{ "success": true, "data": {
"tableId": "bah%C3%A7e1", // doküman id (target.id ile aynı)
"tableName": "Bahçe1", // görünen ad
"docNo": 7,
"desing": "Bahçe", // masa/alan
"location": "Bahçe1",
"personCount": 0,
"total": 360.5,
"paid": 50,
"totalDiscount": 0,
"orders": [
{ "id": "bah%C3%A7e1-7c08", "title": "HYPATİA KAHVALTI", "quantity": 1, "options": [], "extra": 0, "discount": 0, "note": "", "lineTotal": 160 },
{ "id": "bah%C3%A7e1-9624", "title": "KÖRİ SOSLU TAVUK", "quantity": 1, "options": [], "extra": 0, "discount": 6.5, "note": "", "lineTotal": 58.5 }
]
// "customer": { … } // dine-in'de genelde yok; varsa customers:read + consent ile
}}| Alan | Açıklama |
|---|---|
| tableId | Doküman id (target.id ile aynı; URL-encoded olabilir). |
| tableName / desing / location | Masanın görünen adı / alanı / konumu. |
| total / paid / totalDiscount | Hesap toplamı / ödenen / indirim toplamı. |
| orders[] | Sipariş satırları (aşağıdaki şema). |
| customer | Varsa müşteri (PII; customers:read + consent ile). Dine-in'de genelde yok. |
Temiz satır — iç alanlar (ham product objesi, log, requestId, storages…) gönderilmez; yalnız ihtiyacın olanlar:
| Alan | Açıklama |
|---|---|
| id | Satır id (referans). |
| title | Ürün adı. |
| quantity | Adet. |
| options | Seçili seçenek adları (string array). |
| extra / discount | Ekstra / satır indirimi. |
| note | Satır notu. |
| lineTotal | Satır toplamı (Restomenum hesaplar). |
customer alanları webhook ile aynı kuralla kırpılır: customers:read yoksa PII alanları (name, phone, address, email, tckn, vergino) silinir. Dine-in masalarda customer genelde hiç bulunmaz.| Durum | Yanıt |
|---|---|
| Masa yok (veya çift-decode'lu id) | { success:false, message:"plugin.tables.notFound" } |
| Scope yok | { success:false, message:"plugin.scope.denied" } |
// table.close gate (/api/hook) içinde: gate yalnız target.id taşır → masanın DOLU hesabını çek.
const r = await fetch(`${BASE}/plugin-api/tables/get?id=${encodeURIComponent(hook.target.id)}`, {
headers: { authorization: 'Bearer ' + apiKey }, // kurulumdaki install API key
}).then((x) => x.json());
const bill = r.data; // bill.total, bill.orders → faturayı kes