Clone
1
API specification for room booking
Andreas Svanberg edited this page 2025-04-29 14:19:32 +02:00
GET /rooms
Authorization: Bearer <oauth2 token> # includes who *I* am
Content-Type: application/json

# All the rooms, grouped by campus, that I (identified by the token) can book
# A list of campuses each with their timezone and available rooms
# room availability is the interval where it is possible to book the room, not taking into account any actual bookings
# Room ids are globally unique
{
  "campuses": [
    {
      "name": "NOD",
      "timezone": "Europe/Stockholm",
      "rooms": [
        {
          "id": "<opaque room id>",
          "name": "Aula",
          "capacity": 100,
          "availability": {
            "from": "06:00",
            "to": "22:00"
          }
        },
        {
          ...
        }
      ]
    },
    {
      ...
    }
  ]
}

###

# ISO 8601 format
# Can ask for multiple rooms
GET /rooms/bookings?from=YYYY-MM-DD'T'HH:MMZ&to=YYYY-MM-DD'T'HH:MMZ&rooms={id,id,...}
Authorization: Bearer <oauth2 token>
Content-Type: application/json

[
  {
    "id": "<opaque booking id>",
    "from": "2025-01-01T12:00Z",
    "to": "2025-01-01T13:00Z",
    "room_id": "<opaque booking id>",
    "title": "Seminar"
  },
  ...
]

###

# Book a room
POST /rooms/bookings
Authorization: Bearer <oauth2 token>
Content-Type: application/json

# participants are in addition to the student in the token
{
  "room_id": "<opaque booking id>",
  "from": "2025-01-01T12:00Z",
  "to": "2025-01-01T13:00Z",
  "title": "Seminar",
  "participants": [
    "<student ref>"
  ]
}