# List bookings

POS only.

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.

Endpoint: GET /bookings
Version: 1.0
Security: JWT

## Query parameters:

  - `locationId` (string, required)
    The Tyro Connect Location Id of the bookings to be retrieved. This parameter is required.

  - `assetType` (string)
    Returns results for matching asset.type values
    Enum: "ROOM", "TABLE"

  - `tableNumber` (string)
    Returns results based on the table.number of a booking.

Can be a single string or multi string value.
    Example: "outside-table-3"

  - `bookingStatus` (string)
    Returns results based on the status of a booking.

Can be a single string or multi string value.
    Enum: "CREATED", "ACCEPTED", "CANCELLED_BY_CUSTOMER", "CANCELLED_BY_MERCHANT", "REJECTED"

  - `fromDate` (string)
    Returns results that have a "startTime" later than or equal to the provided value.

Format: YYYY-MM-DD
    Example: "2021-04-28"

  - `toDate` (string)
    Returns results that have a "startTime" before than or equal to the provided value.

Format: YYYY-MM-DD
    Example: "2021-04-28"

  - `dateType` (string)
    Determines which booking date information to filter on when searching by date.
    Enum: "CREATED", "UPDATED", "START", "END"

  - `limit` (number)
    Specifies the amount of results to be retrieved.

A maximum of 50 results are returned if this value is not provided.
    Example: 10

  - `page` (number)
    Specify the page to retrieve.

You will need to use this setting if you wish to retrieve specific pages.

Page-numbering is based on the value of "limit". If limit=5, then page=1 will display the hits from 1 to 5, page=3 will display the hits from 11 to 15.

Page numbers start at 1.

A request for a non-existing page will yield 0 results.
    Example: 2

## Header parameters:

  - `Accept` (string, required)
    Enum: "application/vnd.tyro.connect+json;version=1.0"

  - `Authorization` (string, required)

## Response 200 fields (application/json):

  - `results` (array, required)
    The results for the location that satisfy the filtering criteria

  - `results.id` (string, required)
    The id of the booking in the Tyro Connect system
    Example: "0f448ac1-862a-4c7b-bdb4-a3b7cdbf6149"

  - `results.locationId` (string, required)
    The id of the location as specified by the Tyro Connect system

  - `results.origin` (object)
    Information relevant to the booking partner that this booking was created with

  - `results.origin.name` (string)
    Name of the booking app

  - `results.origin.bookingReference` (string, required)
    Reference for the booking. It is used to facilitate identification of the booking in the app and pos systems and must be unique per location and booking partner.

  - `results.asset` (any, required)

  - `results.bookingStatus` (string)
    The current status of the booking
    Enum: "CREATED", "ACCEPTED", "CANCELLED_BY_CUSTOMER", "CANCELLED_BY_MERCHANT", "REJECTED"

  - `results.numberOfPeople` (number, required)
    The number of expected guests

  - `results.payments` (array)
    A list of payments applied to the booking.

  - `results.payments.amount` (integer)
    This is the amount in cents. e.g 12520 is $125.20

  - `results.payments.currency` (string)
    This is always AUD
    Enum: "AUD"

  - `results.payments.description` (string)
    A description of what this payment amount represents
    Example: "Deposit for booking"

  - `results.startTime` (string)
    The date and time the booking starts at the venue. The format of the date time is the notation as defined by [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6)
    Example: "2018-05-02T17:30:00.000Z"

  - `results.endTime` (string)
    The date and time the booking ends at the venue. The format of the date time is the notation as defined by [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6)
    Example: "2018-05-02T18:30:00.000Z"

  - `results.customer` (object)
    The customer making the booking

  - `results.customer.id` (string)

  - `results.customer.name` (string)
    Customer's name

  - `results.customer.notes` (string)
    Notes specific to the customer. For example, 'Loves red wine'.

  - `results.customer.email` (string)
    Customer's email address

  - `results.customer.address` (object)
    The customer address

  - `results.customer.address.line1` (string)

  - `results.customer.address.line2` (string)

  - `results.customer.address.suburb` (string)

  - `results.customer.address.state` (string)

  - `results.customer.address.postcode` (string)

  - `results.customer.address.country` (string)

  - `results.customer.phoneNumber` (string)
    Customer's phone number

  - `results.customer.birthday` (string)
    Customer's birthday

  - `results.notes` (string)
    Notes specific to the booking. Example: 'Window seat please'

  - `results.reason` (string)
    The reason the booking was rejected or cancelled. Provided only when bookingStatus is REJECTED, CANCELLED_BY_MERCHANT or CANCELLED_BY_CUSTOMER

  - `results.createdAt` (string)
    The timestamp when the booking was created
    Example: "2022-11-23T22:39:54.931Z"

  - `results.updatedAt` (string)
    The timestamp when the booking was last updated
    Example: "2022-11-23T22:40:48.237Z"

  - `pagination` (object, required)

  - `pagination.page` (integer, required)

  - `pagination.size` (integer, required)

  - `pagination.limit` (integer, required)

  - `pagination.total` (integer, required)


## Response 403 fields

## Response 404 fields
