Skip to content

Accommodation

An Accommodation is a place to stay or live: a hotel room, a suite, a holiday apartment, a house for sale or to rent. Its kind is additionalType (HotelRoom, Suite, Apartment, House, SingleFamilyResidence...); its building is containedInPlace, a Place such as a Hotel, which lists its units in containsAccommodation. It is sold by Offers (itemOffered: the price per night, inventoryLevel for the free units of a category) and booked by Reservations of kind LodgingReservation: two of them can't hold one Accommodation for overlapping stays (409 STAY_OVERLAPS). A RealEstateListing lists one for sale or to rent. See Hotels and rentals.

Modeled on schema.org/Accommodation · JSON Schema · ABAC object type Accommodation

Example

Create one with POST /accommodations:

{
  "name": [
    {
      "at_language": "en",
      "at_value": "Deluxe double"
    }
  ],
  "additionalType": "HotelRoom",
  "occupancy": {
    "value": 2,
    "unitCode": "C62"
  },
  "bed": [
    {
      "typeOfBed": "Queen",
      "numberOfBeds": 1
    }
  ],
  "floorSize": {
    "value": 28,
    "unitCode": "MTK"
  },
  "amenityFeature": [
    {
      "name": [
        {
          "at_language": "en",
          "at_value": "Balcony"
        }
      ],
      "valueBoolean": true
    }
  ],
  "containedInPlace": {
    "at_id": "https://apis.objectsgrid.com/places/3b9c1d2e-4f5a-4b6c-8d7e-9f0a1b2c3d4e"
  }
}

Fields

Required: name.

Field Type Required Description
at_context https://schema.org JSON-LD @context, always https://schema.org.
at_type Accommodation JSON-LD @type, the object's type name.
at_id URL The object's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>, its JSON-LD @id: what References to it hold. Assigned by ObjectsGrid.
id string The object's id. Assigned by ObjectsGrid when the object is created.
identifier string The object's id, as Schema.org identifier. Assigned by ObjectsGrid.
url URL The object's own URL, https://apis.objectsgrid.com/<path>/<id>. Assigned by ObjectsGrid.
additionalType one of Room, HotelRoom, MeetingRoom, Suite, Apartment, CampingPitch, House, SingleFamilyResidence The kind of accommodation, a Schema.org subtype of Accommodation: its JSON-LD @type. None for an Accommodation.
name list of LanguageTaggedString Yes The Accommodation name. See schema.org/name.
description list of LanguageTaggedString The Accommodation description. See schema.org/description.
image list of URL Image URLs
accommodationCategory string The category, e.g. 'Deluxe double', or a real estate category such as 'Apartment'
occupancy QuantitativeValue How many people it takes: value the most guests, unitCode C62
bed list of BedDetails Its beds
floorSize QuantitativeValue The floor area, unitCode MTK (square metres) or FTK (square feet)
floorLevel string The floor it is on, e.g. '3', 'Ground'
numberOfRooms number The number of rooms
numberOfBedrooms number The number of bedrooms
numberOfBathroomsTotal integer The number of bathrooms
numberOfFullBathrooms number Full bathrooms: a sink, a toilet and a shower or bath
numberOfPartialBathrooms number Partial bathrooms: without a shower or bath
yearBuilt integer The year it was built
amenityFeature list of LocationFeatureSpecification Amenities, e.g. 'Wi-Fi', 'Balcony'
petsAllowed boolean Whether pets are allowed
smokingAllowed boolean Whether smoking is allowed
permittedUsage string What it may be used for, e.g. 'Residential'
tourBookingPage URL A page where a viewing or tour is booked
address PostalAddress Its address, when its building's isn't enough
geo GeoCoordinates Its coordinates
containedInPlace Reference to Place The building or site it is in: a Hotel, an ApartmentComplex, a Campground
tags list of Tag Tags your ABAC policy decides on. Created empty when not sent, kept by a PUT that leaves them out, cleared by null or [].
meta ObjectMeta Read-only metadata: version, type, creation and last update.

REST API

Base URL https://apis.objectsgrid.com. Every request sends the X-ObjectsGrid-AccessPoint and Authorization: Bearer <access token> headers; see the REST API guide.

Operation Request
Create POST /accommodations
List and search GET /accommodations
Create up to 100 at once POST /accommodations/batch
Retrieve GET /accommodations/{id}
Retrieve as a JSON-LD document for your pages GET /accommodations/{id} with Accept: application/ld+json; see JSON-LD for your pages
Replace PUT /accommodations/{id}
Update some fields PATCH /accommodations/{id}
Delete DELETE /accommodations/{id}

The OpenAPI contract, with every parameter and response: Accommodations (JSON).

GraphQL

Endpoint POST https://apis.objectsgrid.com/graphql; see the GraphQL guide.

Operation Field
Query accommodation(id: ID!, version: String): Accommodation
Query accommodations(where: AccommodationWhereInput, orderBy: [AccommodationOrderByInput!], first: Int, after: String): AccommodationConnection!
Query accommodationsGroupBy(by: [AccommodationGroupByField!]!, where: AccommodationWhereInput, having: AccommodationHavingInput, orderBy: [AccommodationGroupByOrderByInput!], first: Int, after: String): AccommodationGroupByConnection!
Mutation createAccommodation(input: CreateAccommodationInput!): Accommodation!
Mutation updateAccommodation(input: UpdateAccommodationInput!, expectedVersion: String): Accommodation!
Mutation deleteAccommodation(id: ID!, expectedVersion: String): Boolean!

Webhook events

Subscribe to these events in your webhook configuration to be called when an Accommodation changes:

AccommodationCreated, AccommodationUpdated, AccommodationPatched, AccommodationDeleted.