Statistiques

Stats & comptages

Consultez en temps réel le nombre de réservations et de couverts, par date, par période, ou par service.

Stats rapides

GET/api/v1/stats

Vue d'ensemble du restaurant : totaux pending / confirmed / today / cette semaine.

bash
curl https://api.restaurateur.ch/api/v1/stats \
  -H "X-API-Key: VOTRE_CLE_API"
json
{
  "stats": {
    "pending": 5,
    "confirmed_today": 12,
    "confirmed_this_week": 78,
    "no_show_last_30d": 3,
    "cancelled_last_30d": 9,
    "total_guests_today": 28,
    "total_guests_this_week": 184
  }
}

Comptages détaillés

GET/api/v1/stats/counts

Comptages flexibles par filtre : retourne le nombre de réservations et le nombre total de couverts (somme des party_size).

Paramètres

NomTypeNotes
dateYYYY-MM-DDUne date précise
fromYYYY-MM-DDDate début (inclus)
toYYYY-MM-DDDate fin (inclus)
servicestringCode service (ex: lunch)
statusstringDéfaut : confirmed,pending
group_bystringdate, service, status

Exemples

bash
# Total couverts demain
curl "https://api.restaurateur.ch/api/v1/stats/counts?date=2026-06-15" \
  -H "X-API-Key: VOTRE_CLE_API"

# Couverts du lunch ce mois
curl "https://api.restaurateur.ch/api/v1/stats/counts?from=2026-06-01&to=2026-06-30&service=lunch" \
  -H "X-API-Key: VOTRE_CLE_API"

# Par date pour faire un graphique
curl "https://api.restaurateur.ch/api/v1/stats/counts?from=2026-06-01&to=2026-06-30&group_by=date" \
  -H "X-API-Key: VOTRE_CLE_API"
json
{
  "filters": { "from": "2026-06-01", "to": "2026-06-30", "service": "lunch", "status": "confirmed,pending" },
  "totals": { "bookings": 86, "guests": 197 },
  "groups": [
    { "key": "2026-06-01", "bookings": 4, "guests": 9 },
    { "key": "2026-06-02", "bookings": 6, "guests": 14 }
  ]
}
Astuce : Couplez /stats/counts?service=lunch&date=DEMAIN avec services[i].max_total_guests pour calculer en temps réel le taux d'occupation d'un service.