1.0.3 • Published 6 years ago

ucd-api v1.0.3

Weekly downloads
17
License
-
Repository
-
Last release
6 years ago

UCD API

This module provides an unofficial API to retrieve class information, including past and future data. It provides data for scheduling, enrollment, and more.

Features

  • Get section information for any class
  • Get enrollment data for sections and classes
  • Retrieve schedules, including times and locations, for any section
  • See which classes will be offered for any major
  • Find prereqs for a class
  • Retrieve final dates and GE credits
  • See which professor is teaching a class
  • Open source and extensible

Usage

UCD API is a Node.js module which can be installed from NPM:

npm install ucd-api

Using the API, you can quickly and easily access class information. All requests are processed asynchronously, so you can send multiple non-blocking requests in parallel. Take a look at this usage example:

var ucd = require("ucd-api");

//Which sections of ECS 30 are there?
ucd.getSections("ECS 30", console.log);                      //["60104","60105",...]

//How many seats are available in that first section?
ucd.getSectionDetails("60104", function (section) {
    console.log(section.availableSeats);                     //2
});

//Who will teach ECS 20 next quarter?
ucd.getSections("ECS 20", function (sections) {
    ucd.getSectionDetails(sections[0], function (section) {
        console.log(section.instructor);                     //John Doe
    }, "2018", "Fall Quarter");
}, "2018", "Fall Quarter");

Documentation

getClassesInMajor(major, callback, year, quarter)

Retrieves a list of all classes within a major. Year and quarter are optional. Returns an array of strings with the name of each class (ex: ["ECS 10", "ECS 20", ...]).

getSections(className, callback, year, quarter)

Retrieves a list of all sections of a class. Year and quarter are optional. Returns an array of strings with the CRN of each section (ex: ["60104","60105",...]).

getSectionDetails(crn, callback, year, quarter)

Retrieves an object with information about the section. Year and quarter are optional. Returns a JSON object with these properties:

sectionDetails = {
	title,
	subjectArea,
	term,
	instructor,
	units,
	geCredits,
	availableSeats,
	totalSeats,
	finalExam,
	dropPeriod,
	description,
	prereqs,
	meetingTimes
}

The class meeting times are represented by an array of meetings, which are objects that have a time, day, and location. For instance,

meetingTimes = [{
	days: "MWF",
    time: "1:00 - 2:00 PM",
    location: "Big Lecture Hall 123"
}]

License

UCD API is released under the MIT License.