Une API REST documentée, des webhooks signés et un bac à sable gratuit. Connectez un site web, un écran de cuisine, un CRM ou un outil de comptabilité à n'importe quel restaurant sur BookNDish, avec l'autorisation du propriétaire.
La référence de l'API ci-dessous est rédigée en anglais.
Démarrage rapide
01
Obtenez un jeton
Le propriétaire du restaurant ou un responsable ouvre Réglages, puis Développeurs, et crée un jeton avec les portées dont votre intégration a besoin, ou un jeton de bac à sable pour démarrer sur des données d'exemple. Un jeton appartient à un seul restaurant et n'est affiché qu'une fois.
02
Appelez l'API
Envoyez le jeton comme jeton Bearer. Chaque réponse est en JSON avec data, meta et links.
03
Écrivez en toute sécurité
Donnez à chaque POST un Idempotency-Key. Une nouvelle tentative avec la même clé renvoie la première réponse, et rien ne s'exécute deux fois.
URL de 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.
Ajoutez une adresse https dans Réglages, puis Développeurs, et choisissez ses événements. Chaque envoi est un POST signé : répondez avec n'importe quel code 2xx en moins de 10 secondes. Un échec est retenté après 1 minute, 5 minutes, 30 minutes, 2 heures et 6 heures, et le journal des envois peut le rejouer.
Événements
order.created
Une commande est passée sur n'importe quel canal.
order.status_changed
Une commande passe à un autre statut.
order.paid
Les paiements couvrent la commande.
reservation.created
Une réservation est faite, par le client ou par l'équipe.
reservation.updated
Une réservation est modifiée.
reservation.cancelled
Une réservation est annulée.
menu.item_updated
Un plat change : prix, nom, épuisé.
payment.refunded
Un paiement est remboursé.
guest.created
Un profil client est créé.
guest.updated
Les informations ou le consentement d'un client changent, ou le client est effacé.
giftcard.issued
Une carte cadeau est vendue ou émise.
giftcard.redeemed
Une carte cadeau règle une commande.
review.created
Un client laisse une note.
stock.below_par
Un ingrédient passe sous son niveau de référence dans un établissement.
shift.published
Un responsable publie une semaine de services.
experience.booked
Les billets d'une expérience sont payés.
Vérifier la signature
BookNDish-Signature contient t, une heure Unix, et v1, le HMAC-SHA256 hexadécimal de t, d'un point et du corps brut, calculé avec votre secret de signature. Comparez en temps constant et refusez un t vieux de plus de cinq minutes.
Un bac à sable est un établissement d'exemple à part, avec un menu, des tables, des clients, une réservation et une commande, derrière un seul jeton disposant de toutes les portées. Il répond à la même adresse avec un en-tête BookNDish-Sandbox, ne touche jamais le restaurant réel et revient à ses données d'exemple chaque nuit.
Créez-en un dans Réglages, puis Développeurs, puis Bac à sable. Son jeton commence par bnd_sbx_.
Limites et erreurs
Chaque jeton peut faire 60 requêtes par minute par défaut. Chaque réponse contient X-RateLimit-Remaining, et un 429 contient Retry-After.
Un échec répond avec error.code, error.message et error.details. Un jeton ne voit jamais que son propre restaurant : tout le reste donne un 404.
v1 ne fait que s'enrichir : nouveaux points d'accès, champs facultatifs et événements. Un changement qui casserait un client va dans v2, et v1 est conservée à côté.