Un'API REST documentata, webhook firmati e una sandbox gratuita. Collega un sito web, un display di cucina, un CRM o uno strumento di contabilità a qualsiasi ristorante su BookNDish, con il permesso del titolare.
Il riferimento dell'API qui sotto è scritto in inglese.
Guida rapida
01
Ottieni un token
Il titolare del ristorante o un responsabile apre Impostazioni, poi Sviluppatori, e crea un token con gli ambiti che servono alla tua integrazione, oppure un token sandbox per iniziare con dati di esempio. Un token appartiene a un solo ristorante e viene mostrato una sola volta.
02
Chiama l'API
Invia il token come token Bearer. Ogni risposta è in JSON con data, meta e links.
03
Scrivi in sicurezza
Dai a ogni POST un Idempotency-Key. Un nuovo tentativo con la stessa chiave riceve la prima risposta e nulla viene eseguito due volte.
URL di base: https://restaurant-saas-19qm.onrender.com/api/v1
meta.now says what menus by time of day and happy hours make of the menu right now, on the default branch's clock: whether it and each category are open, and each dish or size a happy hour has cut, at the price charged now.
name and description are a string in the restaurant's default language, or a translation map. A dish is priced by price_minor, or per size by variants.
Only the fields sent change; variants and modifier groups are kept. A price change is recorded in the activity log. A dish priced per size refuses price_minor.
The order is priced from the menu (any price in the body is ignored), the owner's ordering rules apply (types offered, minimum order, delivery zones, opening hours; an order outside hours is held for the next opening), the kitchen gets its tickets and a connected POS gets the order. Dine-in orders need table_code.
placed to accepted or rejected, accepted to ready, ready to completed, and anything not finished to cancelled. Accepting fires the kitchen. A cancel with a reason (3 to 200 characters) also voids the kitchen tickets and keeps the reason.
Guest profiles, with contact details only for guests who agreed to share them.
GET/guests
Guest profiles, a page at a time
Guests who asked to be forgotten never appear. Phone and email are included only for guests who agreed to hear from the restaurant. Staff notes are never included.
Apps from the marketplace: a venue owner allows an app on the consent screen, and the app exchanges the code for an access token (used as the bearer token of every operation above) and a refresh token. Authorization code with PKCE (S256).
POST/oauth/token
Exchange a code, or refresh, for tokens
authorization_code: redeem the code the venue's consent sent to your redirect address, with the PKCE verifier. refresh_token: get a new access token and a new refresh token; the old pair stops working. Authenticate with your client id and secret, as HTTP Basic or as client_id and client_secret in the body. Answers are never cached.
Gives back a refresh token (with its access token) or an access token (RFC 7009). An unknown token is not an error. Authenticate with your client id and secret, as HTTP Basic or as client_id and client_secret in the body. To end the whole grant, the venue uninstalls the app.
Aggiungi un indirizzo https in Impostazioni, poi Sviluppatori, e scegli i suoi eventi. Ogni consegna è un POST firmato: rispondi con un qualsiasi 2xx entro 10 secondi. Un errore viene ritentato dopo 1 minuto, 5 minuti, 30 minuti, 2 ore e 6 ore, e il registro delle consegne può rieseguirlo.
Eventi
order.created
Viene effettuato un ordine su qualsiasi canale.
order.status_changed
Un ordine passa a un altro stato.
order.paid
I pagamenti coprono l'ordine.
reservation.created
Viene fatta una prenotazione, dall'ospite o dal personale.
reservation.updated
Una prenotazione cambia.
reservation.cancelled
Una prenotazione viene annullata.
menu.item_updated
Un piatto cambia: prezzo, nome, esaurito.
payment.refunded
Un pagamento viene rimborsato.
guest.created
Viene creato il profilo di un ospite.
guest.updated
I dati o il consenso di un ospite cambiano, oppure l'ospite viene cancellato.
giftcard.issued
Una carta regalo viene venduta o emessa.
giftcard.redeemed
Una carta regalo paga un ordine.
review.created
Un ospite invia una valutazione.
stock.below_par
Un ingrediente scende sotto la scorta minima in una sede.
shift.published
Un responsabile pubblica una settimana di turni.
experience.booked
I biglietti per un'esperienza vengono pagati.
Verifica la firma
BookNDish-Signature contiene t, un orario Unix, e v1, l'HMAC-SHA256 esadecimale di t, un punto e il corpo grezzo, con il tuo segreto di firma come chiave. Confronta in tempo costante e rifiuta un t più vecchio di cinque minuti.
Una sandbox è un locale di esempio tutto suo, con menu, tavoli, ospiti, una prenotazione e un ordine, dietro un solo token con tutti gli ambiti. Risponde allo stesso indirizzo con un header BookNDish-Sandbox, non tocca mai il ristorante reale e torna ai suoi dati di esempio ogni notte.
Creane una in Impostazioni, poi Sviluppatori, poi Sandbox. Il suo token inizia con bnd_sbx_.
Limiti ed errori
Ogni token può effettuare 60 richieste al minuto per impostazione predefinita. Ogni risposta contiene X-RateLimit-Remaining, e un 429 contiene Retry-After.
Un errore risponde con error.code, error.message ed error.details. Un token vede sempre e solo il proprio ristorante: qualsiasi altra cosa è un 404.
v1 può solo crescere: nuovi endpoint, campi facoltativi ed eventi. Una modifica che romperebbe un client va in v2, e v1 resta al suo fianco.