Last active
October 5, 2017 16:04
-
-
Save ChristopherHammond13/a6251a19afb544fe65ff3697a376d162 to your computer and use it in GitHub Desktop.
Example UCL API Request to show all Centrally Bookable rooms at UCL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
# Set the token value below to your UCL API token | |
token = "uclapi-abcdefghijklmn-abcdefghijklmn-abcdefghijklmn-abcdefghijklmn" | |
def get_rooms(): | |
params = { | |
"token": token | |
} | |
url = "https://uclapi.com/roombookings/rooms" | |
r = requests.get(url, params=params) | |
rooms = r.json() | |
for room in rooms["rooms"]: | |
room_data = "{} in {} has a capacity of {}".format( | |
room["roomname"], | |
room["sitename"], | |
room["capacity"] | |
) | |
print(room_data) | |
if __name__ == "__main__": | |
get_rooms() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment