# Booking API

The API allows the POS to send and receive information about bookings. Currently the API supports creating walk-in bookings, updating and retrieving existing bookings in the POS or the booking system.


Version: 1.0

## Servers

Production
```
https://api.tyro.com/connect
```

## Security

### JWT

Type: openIdConnect
OpenID Connect URL: https://auth.connect.tyro.com/.well-known/openid-configuration

## Download OpenAPI description

[Booking API](https://docs.connect.tyro.com/_bundle/pos/apis/booking/1.0/index.yaml)

## Other

### Create booking

 - [POST /bookings](https://docs.connect.tyro.com/pos/apis/booking/1.0/other/create-booking-request.md): This endpoint is used to notify Tyro Connect about a new walk-in booking and will create a booking in the App system.

The id that is returned as a part of the response should be used to identify the booking for subsequent events or retrieving the details via the GET endpoint or during updates via the PATCH endpoint

### List Bookings

 - [GET /bookings](https://docs.connect.tyro.com/pos/apis/booking/1.0/other/list-bookings.md): This endpoint returns all the bookings of a given location. The list of bookings is paginated and it is possible to apply filters to the bookings being fetched.

## Filtering

The filtering options use an "OR" clause within the same filter criteria and an "AND" clause between criteria.

This means that a request with bookingStatus=ACCEPTED&tableNumber=10 will return the bookings that were ACCEPTED and that have table 10 associated.

A request with tableNumber=22&tableNumber=10 will return the bookings that have either table 22 or table 10.

## Pagination

The paginated results are ordered using the sequence they were created in the Tyro Connect. For example results[0] on page 1 is the first matching booking that was created in the Tyro Connect system.

Please Note: Results are not sorted by date. If you require the results to be sorted make sure you fetch all the pages before applying a sort to the list of records.

### Get Booking

 - [GET /bookings/{bookingId}](https://docs.connect.tyro.com/pos/apis/booking/1.0/other/get-booking.md): This endpoint is for fetching the details of a booking

### Update Booking

 - [PATCH /bookings/{bookingId}](https://docs.connect.tyro.com/pos/apis/booking/1.0/other/patch-booking.md): This endpoint is for updating a booking

### Get Booking Events

 - [GET /bookings/{bookingId}/events](https://docs.connect.tyro.com/pos/apis/booking/1.0/other/get-booking-events.md): This endpoint is for fetching the events associated with a booking. The events are ordered with the most recent event first.

