# Booking API referentie :id=page-title

Gebruik de Booking API om realtime beschikbaarheid van restaurants op te vragen en reserveringen te maken, bekijken, wijzigen of annuleren.

De HATEOAS REST API gebruikt standaard HTTP-methoden, UTF-8 codering en URL-gecodeerde waarden. Request- en responsebodies gebruiken JSON. Reserveringsgegevens volgen het Schema.org model `Thing > Intangible > Reservation > FoodEstablishmentReservation`. Zie [de schemadefinitie](https://schema.org/FoodEstablishmentReservation).

## Basis-URL en specificatie :id=specification

```text
https://eTender-connect.com/v1
```

De Swagger 2.0 specificatie bevat de request- en responseschema's.

<a class="gp-action-link" href="https://www.eTender-connect.com/v1/specs/swagger.json">Download de Swagger 2.0 specificatie</a>

## Autorisatie en toegang :id=authorization

[Neem contact op met Guestplan](contact_us.md) om een toegangssleutel aan te vragen. Vermeld of deze voor meerdere restaurants moet werken. Verstuur de sleutel in de HTTP-autorisatieheader:

```http
Authorization: Bearer <AccessKey>
```

| Endpointgroep | Toegang |
| --- | --- |
| Booking | Alle abonnementen |
| Export | Alleen Ultimate |
| Occupancy | Alleen Guestplan Partners |

## Netwerk en aanvraaglimieten :id=limits

Aanvragen vanuit het Guestplan platform gebruiken de IP-adressen **185.22.13.210 tot en met 185.22.13.212**.

Inkomende API-aanvragen zijn beperkt tot **10 aanvragen per seconde per IP-adres**, met pieken tot **20 aanvragen**. Bij overschrijding volgt een foutantwoord.

## Resources en methoden :id=endpoints

Voeg het resourcepad toe aan de basis-URL. De namen van parameters hieronder volgen de bestaande referentie; raadpleeg de Swaggerdefinitie bij het opbouwen van aanvragen.

| Methode | Pad | Resultaat |
| --- | --- | --- |
| `GET` | `/restaurants/` | Restaurants die toegankelijk zijn voor de toegangssleutel of reserveringspartner |
| `GET` | `/restaurants/{restaurantId}` | Restaurant op account-ID |
| `GET` | `/restaurants/{restaurantId}/availability` | Beschikbaarheid per datum voor alle datums |
| `GET` | `/restaurants/{restaurantId}/availability/{year}` | Beschikbaarheid per datum voor een jaar |
| `GET` | `/restaurants/{restaurantId}/availability/{year}/{month}` | Beschikbaarheid per datum voor een maand |
| `GET` | `/restaurants/{restaurantId}/availability/{year}/{month}/{day}` | Beschikbaarheid per tijdstip op een datum |
| `GET` | `/restaurants/{restaurantId}/reservations/{reservationId}` | Reserveringsgegevens |
| `POST` | `/restaurants/{restaurantId}/reservations` | Een reservering maken |
| `PATCH` | `/restaurants/{restaurantId}/reservations/{reservationCode}` | Een reservering wijzigen |
| `DELETE` | `/restaurants/{restaurantId}/reservations/{reservationcode}` | Een reservering verwijderen/annuleren |

## Foutreferentie :id=errors

De onderstaande berichten behouden de tekst van het API-antwoord, inclusief placeholders. De HTTP-statusgroepen volgen de bestaande API referentie.

### HTTP 400 :id=http-400

| Code | API-bericht |
| --- | --- |
| `2001` | `Timeslot {reservationDate} is not available for table reservation.` |
| `2002` | `Party size {partySize} exceeds the available party size.` |
| `2003` | `Party size {partySize} is too small.` |
| `2004` | `No time specified.` |
| `2005` | `No date specified.` |
| `2006` | `Date {date}, or time {time} are not in a valid format, should be yyyy-MM-dd and HH:mm.` |
| `2007` | `Could not allocate a table for party size {partySize} while table allocation is required.` |
| `2015` | `Timeslot does not exist.` |
| `2016` | `Timeslot not available and not available with waitlist.` |
| `2101` | `Reservation has no contact information.` |
| `2102` | `Contact should have a title.` |
| `2103` | `Contact should have a name.` |
| `2104` | `Contact should have a phone number.` |
| `2105` | `Contact should have an email address.` |
| `2106` | `Contact should have a valid email address, email address is {email}.` |
| `2107` | `Contact should have a gender.` |
| `6001` | `Invalid date: {year}/{month}/({day}). Dates should be formatted as yyyy/MM/(dd).` |
| `6002` | `Invalid date: {year}/{month}/({day}). Dates should not be in the past.` |

### HTTP 401 :id=http-401

| Code | API-bericht |
| --- | --- |
| `3001` | `No authorization header.` |
| `3002` | `No AccessKey present in authorization header.` |
| `3003` | `AccessKey {apiKey} is not a valid AccessKey.` |
| `3004` | `Stripe is not configured.` |
| `3005` | `Stripe payment failed.` |
| `3006` | `Stripe refund failed.` |

### HTTP 404 :id=http-404

| Code | API-bericht |
| --- | --- |
| `4001` | `Restaurant {restaurantId} not found.` |
| `4002` | `Reservation {reservationId} not found.` |
| `4108` | `Service is not valid.` |
| `4401` | `Section {sectionId} is not found.` |
| `4402` | `No available sections found.` |

### HTTP 500 :id=http-500

| Code | API-bericht |
| --- | --- |
| `9999` | `Internal server error.` |
