Eduardo Garcia bio photo


Eduardo Garcia

Knowmad by definition

Location: Australia

Twitter Facebook  QQ交谈 Google+ Github LinkedIn Feed

Waterbed Rooms is a Drupal 7 Feature to create a website similar to with minimal features.


$ git clone

Tweaks and Tricks included

This Feature includes some pretty cool tweaks and tricks. You can read more about them on the waterbed_rooms.module file.

Some of my favorites include:

  • Custom Image Formatter for Services (Uses an absolute path with an option to define an image style preset).

  • View query alter used to add an extra “Group By”.

  • Creates a custom Service Resource (node_waterbed) to return some extra information about the owner. Also it enables field_pictures to return absolute paths.

Drupal Dependencies


Before enabling the Feature Waterbed Rooms, I recommend installing the Rooms module, because it could get a little tricky. You can find instructions on how to do that at (don't forget the libraries section).

Another requirement is applying the patch to Sandbox module Rooms Node.

After you enable the Waterbed Rooms feature, you are required to edit the Content Type "Standard Doubles" (/admin/structure/types/manage/room-standard-doubles) and enable the contact type as a Room Node. (see image)

Edit Content Type Standard Doubles

After creating some Standard Doubles nodes, you need to update the room availability (i.e.: http://YOURDOMAIN/node/1/availability) (see image)

Editing Room Node Availablity


The goal of this project is to create a backend for a service similar to Airbnb, after completing the installation steps and creating some Room Nodes with availability you will be ready to consume the API and fetch room information.

Getting all rooms available


Getting all rooms available in a range of dates.


Getting all rooms available in a range of price


You can combine price and date filtering. In any case we will a get JSON response similar to next example.

    nid: "1",
    legend: "Walk to downtown san jose from here. ",
    images: ",",
    rooms_availability_index_price: "45",
    latitude: "9.896970600000",
    longitude: "-84.061670900000",
    type: "Standard Doubles",
    date: "2014-05-27"
    nid: "2",
    legend: "Apartment in San José North Sabana",
    images: ",",
    rooms_availability_index_price: "60",
    latitude: "9.935231600000",
    longitude: "-84.102606200000",
    type: "Standard Doubles",
    date: "2014-05-27"

You can check out a live demo at


If you’re planning to use your own server to test, remember use the CORS module to enable CORS requests and avoid errors related to invalid client requests because the client isn't located under same domain.Just go to http://YOURDOMAIN/admin/config/services/cors and do a similar setting as suggested below.


Your port is necessary only if you use other port than 80