Réservations
Endpoints pour créer et gérer des réservations.
POST
/api/v1/reservas/crear/
Crée une nouvelle réservation.
Authentification
Cet endpoint peut être utilisé sans JWT pour les réservations d'invités, ou avec JWT pour les clients authentifiés.
Paramètres du corps
| Paramètre | Type | Requis | Description |
|---|---|---|---|
servicio_ids |
array | Oui | Tableau d'IDs de services |
peluquero_id |
integer | Oui | ID du professionnel |
fecha |
string | Oui | Date (AAAA-MM-JJ) |
hora_inicio |
string | Oui | Heure de début (HH:MM) |
nombre |
string | Oui* | Nom du client (*si pas de JWT) |
email |
string | Oui* | Email du client (*si pas de JWT) |
telefono |
string | Oui* | Téléphone (*si configuré comme requis) |
notas |
string | Non | Notes supplémentaires |
usar_puntos |
boolean | Non | Payer avec des points de fidélité |
Exemple de requête
cURL
curl -X POST "https://app.salonbookit.com/api/v1/reservas/crear/" \
-H "X-API-Key: hh_pub_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"servicio_ids": [15],
"peluquero_id": 5,
"fecha": "2024-01-20",
"hora_inicio": "10:30",
"nombre": "Juan Pérez",
"email": "juan@email.com",
"telefono": "+34612345678",
"notas": "Primera visita"
}'
Réponse (201 Created)
JSON
{
"success": true,
"data": {
"id": 12345,
"codigo": "ABC123XY",
"fecha": "2024-01-20",
"hora_inicio": "10:30",
"hora_fin": "11:00",
"servicios": [
{
"id": 15,
"nombre": "Corte Clásico",
"precio": 25.00,
"duracion_minutos": 30
}
],
"profesional": {
"id": 5,
"nombre": "Carlos García"
},
"cliente": {
"id": 456,
"nombre": "Juan Pérez",
"email": "juan@email.com",
"telefono": "+34612345678"
},
"subtotal": 25.00,
"descuento": 0.00,
"total": 25.00,
"moneda": "EUR",
"estado": "confirmada",
"pago_requerido": false,
"pago_pendiente": true,
"puntos_ganados": 25,
"created_at": "2024-01-15T14:30:00Z"
}
}
GET
/api/v1/cliente/reservas/
Liste les réservations du client authentifié.
Nécessite JWTParamètres de requête
| Paramètre | Type | Description |
|---|---|---|
estado |
string | Filtrer : en attente, confirmée, terminée, annulée |
desde |
string | Date depuis (YYYY-MM-DD) |
hasta |
string | Date jusqu'à (YYYY-MM-DD) |
Réponse (200 OK)
JSON
{
"success": true,
"data": {
"reservas": [
{
"id": 12345,
"codigo": "ABC123XY",
"fecha": "2024-01-20",
"hora_inicio": "10:30",
"hora_fin": "11:00",
"servicios": [...],
"profesional": {...},
"total": 25.00,
"estado": "confirmada",
"puede_cancelar": true
}
],
"proxima_reserva": {
"id": 12345,
"fecha": "2024-01-20",
"hora_inicio": "10:30"
},
"total": 15
}
}
GET
/api/v1/reservas/{id}/
Obtient le détail d'une réservation.
Paramètres de chemin
| Paramètre | Type | Description |
|---|---|---|
id |
integer | ID de la réservation |
Requête par code
Vous pouvez aussi interroger en utilisant le code : /reservas/codigo/{codigo}/
POST
/api/v1/reservas/{id}/cancelar/
Annule une réservation existante.
Paramètres du corps
| Paramètre | Type | Requis | Description |
|---|---|---|---|
motivo |
string | Non | Raison de l'annulation |
Exemple de requête
cURL
curl -X POST "https://app.salonbookit.com/api/v1/reservas/12345/cancelar/" \
-H "X-API-Key: hh_pub_live_abc123..." \
-H "Authorization: Bearer eyJhbG..." \
-H "Content-Type: application/json" \
-d '{"motivo": "Cambio de planes"}'
Réponse (200 OK)
JSON
{
"success": true,
"data": {
"id": 12345,
"estado": "cancelada",
"cancelada_en": "2024-01-15T16:00:00Z",
"reembolso": {
"aplica": true,
"monto": 25.00,
"estado": "pendiente"
}
}
}
Erreurs
| Code | HTTP | Description |
|---|---|---|
BOOKING_NOT_FOUND |
404 | Réservation non trouvée |
CANNOT_CANCEL |
400 | La réservation ne peut pas être annulée (déjà passée ou déjà annulée) |
CANCELLATION_DEADLINE_PASSED |
400 | Le délai d'annulation est passé (ex : 24h avant) |
États de réservation
| Statut | Description |
|---|---|
pendiente |
Réservation créée, en attente de confirmation |
confirmada |
Réservation confirmée par le commerce |
completada |
Service effectué |
cancelada |
Annulée par le client ou le commerce |
no_show |
Client absent |