Skip to content

Hotels and rentals

A hotel, a B&B, a campsite or a set of holiday apartments is three things in ObjectsGrid: the property, a Place; what it lets, Accommodations; and the stays, Reservations of kind LodgingReservation.

The property

curl -X POST https://apis.objectsgrid.com/places -H 'X-ObjectsGrid-AccessPoint: EU' -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' -d '{
    "name": [{"at_language": "en", "at_value": "Hotel du Parc"}], "additionalType": "Hotel",
    "checkinTime": "15:00", "checkoutTime": "11:00", "numberOfRooms": 40, "petsAllowed": true,
    "availableLanguage": ["fr", "en"],
    "address": {"streetAddress": "4 rue du Parc", "addressLocality": "Lyon", "postalCode": "69006", "addressCountry": "FR"},
    "amenityFeature": [{"name": [{"at_language": "en", "at_value": "Spa"}], "valueBoolean": true}]}'

checkinTime, checkoutTime, numberOfRooms, starRating (a Rating), petsAllowed, availableLanguage and audience belong to the lodging kinds: LodgingBusiness, Hotel, Motel, Hostel, BedAndBreakfast, Campground, Resort and VacationRental. Other kinds of Place refuse them.

Rooms and units

Each room, suite, apartment or pitch is an Accommodation in the property (containedInPlace):

{"name": [{"at_language": "en", "at_value": "Deluxe double"}], "additionalType": "HotelRoom",
 "accommodationCategory": "Deluxe double", "occupancy": {"value": 2, "unitCode": "C62"},
 "bed": [{"typeOfBed": "Queen", "numberOfBeds": 1}], "floorSize": {"value": 28, "unitCode": "MTK"},
 "containedInPlace": {"at_id": "https://apis.objectsgrid.com/places/<hotel>"}}

The property lists them in containsAccommodation, and a list finds them: GET /accommodations?where={"containedInPlace": {"id": {"equals": "<hotel>"}}, "occupancy": {"value": {"gte": 3}}}.

Prices

The price is an Offer of the Accommodation (itemOffered), per night with a priceSpecification whose unitCode is DAY; a season is an Offer's validFrom and validThrough.

Stays that never double-book

A stay is a Reservation of kind LodgingReservation whose reservationFor is the Accommodation, from checkinTime to checkoutTime:

{"additionalType": "LodgingReservation", "reservationFor": {"at_id": "https://apis.objectsgrid.com/accommodations/<room>"},
 "underName": {"at_id": "https://apis.objectsgrid.com/persons/<guest>"}, "numAdults": 2,
 "checkinTime": "2027-01-10T15:00:00+01:00", "checkoutTime": "2027-01-12T11:00:00+01:00"}

A second stay of the same Accommodation that overlaps it is refused with 409 and the code STAY_OVERLAPS, naming the Reservation that holds the dates, also when both arrive at the same moment. Checking out and in on the same day doesn't overlap. A cancelled stay (reservationStatus ReservationCancelled) frees its nights.

Selling by category

Most hotels sell a Deluxe double, not room 214. Two ways:

  • Book the room: one Accommodation per room, and a stay's reservationFor is the room. The platform prevents double bookings; assign the room when the guest books.
  • Book the category: a stay's reservationFor is the hotel (the Place), and lodgingUnitType names the category, "Deluxe double". Stays of the hotel aren't checked for overlaps, since it has many rooms: keep how many of a category are free in its Offer's inventoryLevel, which your app updates, and assign a room at check-in.

lodgingUnitType, lodgingUnitDescription, numAdults, numChildren, checkinTime and checkoutTime belong to LodgingReservations; other kinds of Reservation refuse them.