pennlabs / penn-sdk-python

A Python module for the various services of Penn OpenData. Validated API token required.
MIT License
30 stars 5 forks source link

Rebuild Study Space API #89

Closed joshdoman closed 6 years ago

joshdoman commented 6 years ago

The API should have four components:

  1. Fetch study space location IDs
  2. Fetch room availability for a given space ID and date
  3. Book room for a given set of room IDs

Sample JSON for (1):

{ 
    "locations": [
        {
            "id": 512,
            "name": "Education Commons",
            "service": "libcal"
        },
        {
            "id": 26,
            "name": "Weigle",
            "service": "libcal"
        },
        {
            ...
        }
    ]
}

Sample JSON for (2):

{
    "location_id": 512,
    "date": "2018-01-25",
    "rooms": [
        {
            "room_id": 3,
            "name": "VP WIC Booth 01 (Capacity 6)",
            "image_url": "<URL HERE>",
            "times": [
                {
                    "booked": true,
                    "start": "5:30pm",
                    "end": "6:00pm"
                },
                {
                    "booked": false,
                    "start": "6:00pm",
                    "end": "6:30pm"
                },
                ...
            ]
        }, 
        {
        ...
        },
        {
        ...
        }    
    ]
}

Sample Request JSON during POST request for (3):

{
           "location_id": 512,
           "room_id": 3,
           "times": [1, 2]
}

Sample Response JSON for (3) (until we can book the room ourself):

{
           "success": true,
           "booking_url": "http://libcal.library.upenn.edu/reserve/spaces/vpdlc/"
}