Purpose: List Princeton-specific data sources (along with helpful instructions on how to use these sources) for developers who want to create the next TigerApp.
If you intend to deploy your app and require CAS authentication on your
app, you must make a request to OIT to whitelist your app’s host. Each
time a user navigates to your app, your browser sends a request to
fed.princeton.edu; your app’s host must be on the CAS whitelist for CAS
authentication to proceed. Note that
localhost is already on
the CAS whitelist.
To whitelist your app, fill out this form.
To use CAS Authentication in your app, you may follow this example from the TigerSnatch code.
Creating a service account netID allows your team to use the same netID to access OIT’s API Store and other CAS-authenticated apps, even after you graduate. The netID is meant to be used only with your app, and not any Princeton student/faculty.
To request a service account, file a ticket through OIT.
Once a service account has been created, you can use the APIs on OIT’s API Store: https://api-store.princeton.edu/store/. To access the site, you must be connected to the Princeton VPN or the Princeton eduroam WiFi network.
By default, the ActiveDirectory and PrincetonInfo APIs are available to you. To access the MobileApp API, you must send an email to the current Director for Software Infrastructure Services and ask them to add your service account netID to the approved accounts for the MobileApp API.
Vinay Ramesh's GitHub repository contains (very) useful examples of calling these APIs in Python and Java. Here's a few tips for using this code:
Note that the API store uses the OAuth3 security protocol to protect its endpoints. On each request to the API, you must pass an access token into the request header. Check out the ReqLib.java/req_lib.py files for an example. An access token lasts for one hour. To update the access token for your app, follow the code in Configs.java/configs.py (the useful method mentioned above in ReqLib.java and req_lib.py updates the access token automatically).
Along with an up-to-date access token, you’ll need the Consumer Key and the Consumer Secret. To get these keys, login to the OIT API Store > Applications > Production Keys. Click Generate Keys to generate your permanent Consumer Key and Consumer Secret. Store these keys securely in your app.
|name: name of group
|Returns all users that belong to a group on campus, e.g. name = “Undergraduate Class of 2023” returns list of netids of students in class of 2023.
|Returns info about a user in the Princeton community, including full name, email, PUID, undergraduate or graduate or faculty, department, student or faculty, and groups that user belongs to. For faculty, also fetches title, phone number, and office location.
|Returns info about a user in the Princeton community, but only a subset of what is returned by /users/full.
|Returns info about a user in the Princeton community, but only a subset of what is returned by /users.
|Returns full names of all departments within Princeton, e.g. “Art Museum”, “Computer Science”, "Pace Ctr for Civic Engagement".
|N/A OR id: department id
|An expanded version of /department. Returns name, id, short, and long description of given department, or all departments if none specified.
term: term id
subject: course department
term: term id
search: query that matches a course title, description, department code, or professor name.
|Returns info on courses in the given term that either match the given subject or search query. Info includes course name, professor name, and list of course sections and each section’s name, time, enrollment.
|Returns info on the current term, including the term id, different formats of the term name, and the start and end date.
|categoryId: type of dining location, e.g. 2: dining halls, 6: amenities such as printers in each hall
|Returns dining locations and in latitude and longitude of the given category.
locationId: dining hall id
menuId: breakfast, lunch, dinner
|Returns a list of food items on the specified menu, including the id, name, description, link, and icons (e.g. vegan) of each item.
|Returns list of places and the name, id, and whether the place is open for each place.
|placeId: id given to each place on campus
|Returns given dining venue’s open hours.
|from: from date, to: to date
|Returns open hours for dining venues.
If none of the OIT APIs provides the data you need, then you may consider working with OIT to create a new API for a Princeton dataset. If interested, send an email to the current Director for Software Infrastructure Services and specify the dataset and its fields you are accessing, the input parameters for each endpoint, and permission from the data owner for OIT to gain access to their database. From there, you will work with OIT to create an API for the API store.
To learn more about OIT, visit https://oit.princeton.edu/get-started.
This API, developed based on the TigerBook app, gives you access to information about undergraduate students you cannot find in the OIT Active Directory API, such as major, name, residential college, and photo.
This public API gives you access to information about objects in, packages in, and makers of the Princeton Art Museum’s collection. The API is well-documented here: https://github.com/Princeton-University-Art-Museum/puam-api-docs.
Huge thanks to Vinay Ramesh '20 for compiling usage information on many Princeton data sources and allowing this doc to reference his code examples.