API

Reservations is an API that allows people to reserve things such as meeting rooms, amenities, buildings or whatever you can imagine.

GET /{clustername}/things Accept JSON

Returns a list of links to things that can be reserved.
[{
    "type" : "room",
    "body" : {
      "name": "Deep Blue",
      "price": {"hourly" : "5", "daily": 50, "currency" : "EUR"},
      "type": "room"
      "opening_hours": [
          {
              "opens" : ["09:00", "13:00"],
              "closes" : ["12:00", "17:00"],
              "dayOfWeek" : 1,
              "validFrom" : "2013-09-26T12:00Z",
              "validThrough" : "2013-09-26T12:00Z"
          }
      ],
      "description" : "Deep Blue is located near the start-up garage.",
      "location" : {
          "map" : {
              "img" : "http://foo.bar/map.png",
              "reference" : "DB"
          },
          "floor" : 1,
          "building_name" : "main"
      },
      "contact" : "http://foo.bar/vcard.vcf",
      "support" : "http://foo.bar/vcard.vcf",
      "amenities" : {
          "http://reservation.{hostname}/{clustername}/amenities/wifi" : {
              "label" : "WiFi Deep Blue"
          },
          "http://reservation.{hostname}/{clustername}/amenities/phone": {
              "label": "phone",
              "number" : "+32 ..."
          },
          "http://reservation.{hostname}/{clustername}/amenities/whiteboard" : {
          }
      }
  }
}]
PUT /{clustername}/things/{thing_name} Accept JSON Auth

Create or update a room and return the room ins JSON.
{
    "type": "room",
    "body": {
        "name": "room 3",
        "price": {"hourly" : "5", "daily": 50, "currency" : "EUR"},
        "type": "room",
        "opening_hours": [
            {
                "opens": ["09:00", "13:00"],
                "closes": ["12:00", "17:00"],
                "dayOfWeek": 1,
                "validFrom": "2013-09-26T12:00Z",
                "validThrough": "2013-09-26T12:00Z"
            }
        ],
        "description": "DeepBlue is located neart he start-upgarage.",
        "location": {
            "map": {
                "img": "http: //foo.bar/map.png",
                "reference": "DB"
            },
            "floor": 1,
            "building_name": "main"
        },
        "contact": "http: //foo.bar/vcard.vcf",
        "support": "http: //foo.bar/vcard.vcf",
        "amenities": {
            "http: //reservation.{hostname}/{clustername}/amenities/wifi": {
                "label": "WiFiDeepBlue"
            },
            "http: //reservation.{hostname}/{clustername}/amenities/phone": {
                "label": "phone",
                "number": "+32..."
            },
            "http: //reservation.{hostname}/{clustername}/amenities/whiteboard": {}
        }
    }
}
GET /{clustername}/reservations Accept JSON

Returns list of activated or blocking reservations made for the current day. Day can be changed with the GET parameter ?day=2013-10-12
[{
"thing" : "http://reservation.{hostname}/{clustername}/DB",
"type": "meetingroom",
"time" : {
    "from" : "2013-09-26T12:00Z",
    "to"      :  "2013-09-26T14:00Z"
 },
 "comment" : "Last time I booked a room there was not enough water in the room, can someone please check?",
 "customer" : {
    "email" : "user@domain.com", "company" : "companyname"
  },
 "subject" : "Board meeting",
 "announce" : ["Jan Janssens", "Yeri Tiete"], // For on screen announcements
}]
GET /{clustername}/things/{thing_name}/reservations Accept JSON

Returns list of activated or blocking reservations made for the current day for the specified thing. Day can be changed with the GET parameter ?day=2013-10-12
[{
"thing" : "http://reservation.{hostname}/{clustername}/DB",
"type": "meetingroom",
"time" : {
    "from" : "2013-09-26T12:00Z",
    "to"      :  "2013-09-26T14:00Z"
 },
 "comment" : "Last time I booked a room there was not enough water in the room, can someone please check?",
 "customer" : {
    "email" : "user@domain.com", "company" : "companyname"
  },
 "subject" : "Board meeting",
 "announce" : ["Jan Janssens", "Yeri Tiete"], // For on screen announcements
}]
POST /{clustername}/reservations Accept JSON Auth

Create or update a reservation and return it as JSON. Returns 400 if thing is occupied or not open when POST. An activation mail will be sent to the given email address.
The reservation blocks the availability of that space for 30 minutes. After that the interval gets released again.
{
"thing" : "http://reservation.{hostname}/{clustername}/DB",
"type": "meetingroom",
"time" : {
    "from" : "2013-09-26T12:00Z", //iso8601
    "to"      :  "2013-09-26T14:00Z"
 },
 "customer" : {
    "email" : "user@domain.com", "company" : "companyname"
 },
 "comment" : "Last time I booked a room there was not enough water in the room, can someone please check?",
 "subject" : "Board meeting",
 "announce" : ["Jan Janssens", "Yeri Tiete"], // For on screen announcements
}
DELETE /{clustername}/reservations/{id} Accept JSON Auth

Cancel a reservation by deleting it.
200 OK
GET /{clustername}/amenities Accept JSON

Returns list of available amenities.
[
    {
        "name" : "wifi",
        "essid" : "deep blue",
        "password" : "passwd",
        "encryption" : "WPA2"
    },
    {
        "name" : "red_phone",
        "number" : "+32 ..."
    }

]
GET /{clustername}/amenities/{amenity} Accept JSON

Returns information about a certain amenity.
[
    {
        "description" : "Broadband wireless access point",
        "schema" : {
          "$schema" : http://json-schema.org/draft-04/schema#",
          "title" : "wifi",
          "description" : "Broadband wireless access point",
          "properties" : [
            "essid" : {
              "description" : "The essid of your wifi access point",
              "type" : "string"
            },
            ...
          ]

        }
    }

]
PUT /{clustername}/amenities/{amenity} Accept JSON Auth

Create or update an amenity and returns it as JSON.
[
    {
        "description" : "Broadband wireless access point",
        "schema" : {
          "$schema" : http://json-schema.org/draft-04/schema#",
          "title" : "wifi",
          "description" : "Broadband wireless access point",
          "properties" : [
            "essid" : {
              "description" : "The essid of your wifi access point",
              "type" : "string"
            },
            ...
          ]

        }
    }

]

The schema has to be a valid json-schema entity, informations about json-schema
are available here http://json-schema.org/.
DELETE /{clustername}/amenities/{amenity} Accept JSON Auth

Remove an amenity when authenticated as customer.
200 OK
GET /{clustername}/companies Accept JSON

Returns list of companies registered on the specified cluster.
[
    {
    "id": "2",
    "cluster_id": "1",
    "name": "company name",
    "domains": "[\"@domain.tld\"]",
    "logo_url": "http://domain.tld/logo.png",
    }
]
        
GET /{clustername}/companies/{company_name} Accept JSON

Returns the company linked to that name if it exists in that cluster.
[
    {
    "id": "2",
    "cluster_id": "1",
    "name": "company name",
    "domains": "[\"@domain.tld\"]",
    "logo_url": "http://domain.tld/logo.png",
    }
]
        
PUT /{clustername}/companies/{company_name} Accept JSON Auth

Create or update a company. And return it as json.
{
  "name" : "new_company2",
  "logo_url" : "http://bizcolostate.files.wordpress.com/2013/08/starbucks-coffee-logo.gif",
  "domains" : ["@cbre.com", "@test.com"] //optional
}
        
DELETE /{clustername}/companies/{company_name} Accept JSON Auth

Remove a company when authenticated as customer.
200 OK