Reservation Endpoints
Get Reservations
GET /api/v1/reservations
Retrieve reservations with optional filters for status and date range.
Optional Query Parameters
status: confirmed | pending | cancelled | completedfrom_date: YYYY-MM-DDto_date: YYYY-MM-DD
JavaScript Example
const params = new URLSearchParams({
status: 'confirmed',
from_date: '2025-02-01',
to_date: '2025-02-28'
});
const response = await fetch(
`https://api_eu.grabatable.app/api/v1/reservations?${params}`,
{
headers: {
'X-API-Key': process.env.GRABATABLE_API_VENUE_SECRET,
'Accept': 'application/json',
}
}
);
const reservations = await response.json();
PHP Example
$response = $client->get('/api/v1/reservations', [
'query' => [
'status' => 'confirmed',
'from_date' => '2025-02-01',
'to_date' => '2025-02-28'
]
]);
$reservations = json_decode($response->getBody(), true);
Create Reservation
POST /api/v1/reservations
Create a new reservation for your venue.
Required Fields
customer_name: string (max 255)customer_email: valid email addresscustomer_phone: string (max 20)reservation_date: YYYY-MM-DD (today or future)reservation_time: HH:mm (24-hour format)party_size: integer (min: 1)
Optional Fields
special_requests: stringtable_id: integer
PHP Example
$response = $client->post('/api/v1/reservations', [
'json' => [
'customer_name' => 'John Smith',
'customer_email' => '[email protected]',
'customer_phone' => '+44 20 1234 5678',
'reservation_date' => '2025-02-15',
'reservation_time' => '19:00',
'party_size' => 4,
'special_requests' => 'Window table if possible'
]
]);
$reservation = json_decode($response->getBody(), true);
JavaScript Example
const response = await fetch('https://api_eu.grabatable.app/api/v1/reservations', {
method: 'POST',
headers: {
'X-API-Key': process.env.GRABATABLE_API_VENUE_SECRET,
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
customer_name: 'John Smith',
customer_email: '[email protected]',
customer_phone: '+44 20 1234 5678',
reservation_date: '2025-02-15',
reservation_time: '19:00',
party_size: 4,
special_requests: 'Window table if possible'
})
});
const reservation = await response.json();
Success Response (201 Created)
{
"message": "Reservation created successfully",
"data": {
"id": 123,
"reference": "GAT-A1B2C3D4",
"customer": {
"name": "John Smith",
"email": "[email protected]",
"phone": "+44 20 1234 5678"
},
"reservation_date": "2025-02-15",
"reservation_time": "19:00",
"party_size": 4,
"status": "confirmed"
}
}