Course API

Bucknell makes course schedule information publically available. We took this public data and put it into a MongoDB database. Then we created a RESTful API for you to access it from you React code (using fetch).

Course objects will be returned as JSON objects from the service with the following schema (Labs, Problems, and Recitations are courses attached to other courses. They are denormalized in the database so appear attached to another course and additionally on their own). The meanings of the fields match the Registrar’s course lookup page. Note, CrseDesc, CrseGuide, and TextBooks contains HTML. You can use this as-is or parse it in your application. Some links omit the hostname (CrseDesc and CrseGuide), the correct hostname is http://www.bannerssb.bucknell.edu/.

{
    CRN: Number,
    Course: String,
    Title: String,
    Year: Number,
    Semester: String,
    "Meeting Time": String,
    Room: String,
    Instructor: String,
    SeatsAvail: Number,
    WaitList: Number,
    ResSeats: Number,
    Prm: String,
    CCCReq: [String],
    CrseDesc: String,
    CrseGuide: String,
    TextBooks: String,
    Department: String,
    CrseNum: String,
    Section: String,
    Notes: [String],
    Labs:[{
      CRN: Number,
      Course: String,
      Title: String,
      Year: Number,
      Semester: String,
      "Meeting Time": String,
      Room: String,
      Instructor: String,
      SeatsAvail: Number,
      WaitList: Number,
      ResSeats: Number,
      Prm: String,
      CCCReq: [String],
      CrseDesc: String,
      CrseGuide: String,
      TextBooks: String,
      Department: String,
      CrseNum: String,
      Section: String,
    }],
    Problems:[{
      CRN: Number,
      Course: String,
      Title: String,
      Year: Number,
      Semester: String,
      "Meeting Time": String,
      Room: String,
      Instructor: String,
      SeatsAvail: Number,
      WaitList: Number,
      ResSeats: Number,
      Prm: String,
      CCCReq: [String],
      CrseDesc: String,
      CrseGuide: String,
      TextBooks: String,
      Department: String,
      CrseNum: String,
      Section: String,
    }],
    Recitations:[{
      CRN: Number,
      Course: String,
      Title: String,
      Year: Number,
      Semester: String,
      "Meeting Time": String,
      Room: String,
      Instructor: String,
      SeatsAvail: Number,
      WaitList: Number,
      ResSeats: Number,
      Prm: String,
      CCCReq: [String],
      CrseDesc: String,
      CrseGuide: String,
      TextBooks: String,
      Department: String,
      CrseNum: String,
      Section: String,
    }]
  }

The server hostname is at http://eg.bucknell.edu:48484/. It only works from on-campus (or the VPN).

An HTTPS version of the server is at https://www.eg.bucknell.edu/~amm042/service/. This link is available both on and off campus!

The server supports one endpoint for queries.

http://eg.bucknell.edu:48484/q?<query>

This is the general query endpoint. You can specify any exact searches on the course schema using the query string. Strings and numbers return exact matches (only!). The CCCReq is an array so, if you specify a CCCReq you can only specify ONE requirement and results that have that requirement will be returned. It will match courses that have other CCCReq’s as well.

For example, all of the CSCI courses in Fall 2018:

  • http://eg.bucknell.edu:48484/q?Semester=Fall&Year=2018&Department=CSCI

You can get creative with this and do things like finding all of the classes in BRKI 165 next fall (note this is URI encoded to handle the space):

  • http://eg.bucknell.edu:48484/q?Semester=Fall&Year=2018&Room=BRKI%20165

All of the W2 courses in Fall 2018:

  • http://eg.bucknell.edu:48484/q?Semester=Fall&Year=2018&CCCReq=W2

All queries by default return only the first 10 matches sorted by CRN number. You can override this by specifying your own limit on the query string. For example,

  • http://eg:48484/q?Semester=Fall&Year=2018&CCCReq=W2&limit=2

will return no more than 2 results), you can set the limit a large number like 99999 if you want everything. You can also skip pages of results by specifying a skip value (the default skip is 0). For example,

  • http://eg:48484/q?Semester=Fall&Year=2018&CCCReq=W2&limit=2&skip=1

will return the 2nd and 3rd results from the query (skipping the first result).

Text Searching

The fields Instructor, Room, and Title support text searching. Just add the text=<search string> to your query as above. If you specify other parameters, they are searched first, then the text search is applied.

What does Felipe teaching in the spring?

  • http://eg:48484/q?Semester=Spring&Year=2019&text=Felipe
  • http://eg:48484/q?Semester=Spring&Year=2019&text=%22Luiz%20Felipe%20F.%22

Spaces can be quoted for literal search, else they are OR’ed. For example, the following queries give very different results (not quote characters and space are URL encoded):

  • http://eg:48484/q?Semester=Spring&Year=2019&text=Sustainable%20Design&limit=100
  • http://eg:48484/q?Semester=Spring&Year=2019&text=%22Sustainable%20Design%22&limit=100

Comment and rating system

User comments and reviews are important to some applications (think shopping on Amazon or look at TripAdvisor). These might be useful to collect about courses. Using this part of the API is totally optional, but it’s here if you want to try it out.

http://eg.bucknell.edu:48484/r/<id>

This is the base review endpoint. It accepts GET and POST messages. The <id> specified as part of the URL refers to the _id member of any course (returned by the query endpoint). For example, CSCI 203 01 has:

"_id": "5aa18acfcb51795075c6cadc"

So to get the comments for this course you could GET (using fetch) the URL:

  • http://eg.bucknell.edu:48484/r/5aa18acfcb51795075c6cadc

Right now you’ll get a response with no reviews, but the review schema is:

  {
    Date: { type: Date, default: Date.now },
    Stars: {type: Number, min:0, max:5},
    Comment: {
      type: String,
      minlength: 10,
      maxlength: 2000
    }
  }

The Date field is automatically inserted on the creation of the comment with the current date/time. Stars are some rating between 0-5 (5 is best!).  Finally, there is a text comment that must be between 10 and 2000 characters.

To submit a comment, simply POST a message to the same URL, eg (http://eg.bucknell.edu:48484/r/5aa18acfcb51795075c6cadc) with a JSON object in the body. You must specify a Comment or the review will be rejected (Stars are not required).