GET /plugin-api/packets/get ✓ CanlıAction ve iframe etkileşimleri yalnızca packetId taşır; paketin DOLU order'ını (ürünler, müşteri, adres, toplam) bu uçtan çekersiniz. Standart desen: etkileşim bir id taşır, veri API'den okunur.
← API Uçları · ortak kurallar (base, auth, hata zarfı) orada.
GET {RESTOMENUM_BASE}/plugin-api/packets/get?packetId=<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).data, webhook packet.created ile aynı kanonik alan ailesini taşır (envelope olmadan); alanların tam açıklaması o referansta. Canlı API yanıtında iki incelik var (aşağıda).
{ "success": true, "data": {
"packetId": "1780950756501",
"docNo": 9,
"entegrasyon": "packet", // sipariş kanalı — STRING kod (packet | yemeksepeti | getir | trendyol …)
"total": 27.8, "paid": 0, "totalDiscount": 0, "paymentNote": "nakit",
"orders": [
{ "id": "1780950755436-de37", "title": "Cortado", "quantity": 1, "options": [],
"extra": 0, "discount": 0, "note": "", "lineTotal": 13.9 }
],
"customer": { // ⚠️ customers:read + consent ile DOLU gelir; yoksa PII alanları kırpılır
"id": "123456", "name": "Ahmet Bayrak", "phone": "123456", "call": "123456",
"address": "Adres", "addressDescription": null, "region": null
}
} }entegrasyon canlı API'de bir string kanal kodudur ("packet", "yemeksepeti" …) — obje değil. orderCode, isScheduled, scheduledDate, note ve orders[].product opsiyoneldir: yalnız ilgili durumda (entegrasyon / ileri tarihli sipariş / not) gelir, manuel pakette yanıtta yer almaz. Eksikliğe dayanıklı parse et.// entegrasyon siparişi + scheduled örnek (ek alanlar):
{
"orderCode": "A12", // platform sipariş kodu (yemeksepeti/getir/trendyol)
"isScheduled": true, "scheduledDate": 1780999999000, // ileri tarihli teslim (epoch ms)
"note": "Zili çalma" // müşteri notu (varsa)
// orders[].product: { title, … } // bazı kanallarda tam ürün objesi de eklenir
}customer alanları webhook ile aynı kuralla kırpılır: customers:read yoksa PII alanları (name, phone, address, email, tckn, vergino) silinir; id vb. kalır.| Durum | Yanıt |
|---|---|
| Paket yok | { success:false, message:"plugin.packets.notFound" } |
| Scope yok | { success:false, message:"plugin.scope.denied" } |
// action-hook (/api/action) ya da iframe (/api/send) içinde: etkileşim yalnız packetId taşır → dolu paketi çek.
const id = envlp.target.id; // packet.created ile aynı packetId (target.type: packet)
const r = await fetch(`${RESTOMENUM_BASE}/plugin-api/packets/get?packetId=${id}`, {
headers: { Authorization: `Bearer ${apiKey}` }, // kurulumdaki install API key
});
const { success, data, message } = await r.json();
if (!success) throw new Error(message); // plugin.packets.notFound | plugin.scope.denied
// data.orders / data.customer / data.total … → kurye/hedef sisteme ilet