A nodejs module to access listings from UCI's schedule of classes, WebSoc. This API allows access to school, department, course, and section data in a hierarchical JSON format.
Type in "Node local.index.js" in the terminal and press enter
const WebSocAPI = require('./websocapi.js');
To retrieve class listings, you just call this function callWebSocAPI
and pass in two parameters. The first parameter, options, is an object-literal
that configures what you're looking for, such as department, term, division etc. The second parameter is a callback function
that is called when the function is done retrieving classes.
Descriptions found here
Name | Formatting | Notes |
---|---|---|
term | [Year] ['Fall'|'Winter'|'Spring'|'Summer1'|'Summer2'|'Summer10wk'] Example: '2017 Fall' Default: ' ' |
Required. Schedule for your selected term must be available on WebSoc. |
GE | ['ANY'|'GE-1A'|'GE-1B'|'GE-2'|'GE-3'|'GE-4'|'GE-5A'|'GE-5B'|'GE-6'|'GE-7'|'GE-8'] Example: 'GE-1B' Default: ' ' |
Must specify at least one of department, GE, courseCodes, or instructorName |
department | List of available departments to search available in file depts.txt Example: 'I&C SCI' Default: ' ' |
Must specify at least one of department, GE, courseCodes, or instructorName |
courseNum | Any valid course number or range Example: '32A' OR '31-33' Default: ' ' |
|
division | ['ALL'|'LowerDiv'|'UpperDiv'|'Graduate'] Example: 'LowerDiv' Default: 'ALL' |
|
courseCodes | Any valid 5-digit course code or range Example: "36531" OR "36520-36536" Default: ' ' |
Must specify at least one of department, GE, courseCodes, or instructorName |
instructorName | Any valid instructor last name or part of last name Example: 'Thornton' Default: ' ' |
Enter last name only |
courseTitle | Any text Example: 'Intro' Default: ' ' |
|
classType | ['ALL'|'ACT'|'COL'|'DIS'|'FLD'|'LAB'|'LEC'|'QIZ'|'RES'|'SEM'|'STU'|'TAP'|'TUT'] Example: 'LAB' Default: 'ALL' |
|
units | Any integer or decimal with only tenths place precision, or 'VAR' to look for variable unit classes only. Example: '5' OR '1.3' Default: ' ' |
|
days | ['M'|'T'|'W'|'Th'|'F'] or a combination of these days Example: 'T' OR 'MWF' Default: ' ' |
|
startTime | Any time in 12 hour format Example: '10:00AM' OR '5:00PM' Default: ' ' |
Only enter sharp hours |
endTime | Any time in 12 hour format Example: '12:00AM' OR '6:00PM' Default: ' ' |
Only enter sharp hours |
maxCap | Exact number like '300' or modified with '<' or '>' to indicate less than specified or greater than specified. Example: '>256' OR '19' OR '<19' Default: ' ' |
|
fullCourses | ['ANY'|'SkipFullWaitlist'|'FullOnly'|'OverEnrolled'] 'SkipFullWaitlist' means that full courses will be included if there's space on the wait-list 'FullOnly' means only full courses will be retrieved 'OverEnrolled' means only over-enrolled courses will be retrieved Example:'SkipFullWaitlist' Default: 'ANY' |
|
cancelledCourses | ['Exclude'|'Include'|'Only'] Example: 'Include' Default: 'EXCLUDE' |
|
building | Any valid building code Example: 'DBH' Default: ' ' |
The value is a building code. Building codes found here: https://www.reg.uci.edu/addl/campus/ |
room | Any valid room number Example: '223' Default: ' ' |
You must specify a building code if you specify a room number |
Callback is a callback function that is called when the class data retrieval is finished. It passes in result, which is an array of School
objects.
// Import the module
const WebSocAPI = require('./websocapi.js');
//Specify our search parameters
const opts = {
term: '2017 Fall',
GE: 'GE-2',
instructorName: 'Pattis'
}
// Call the module, and when it is done, print out every school's name
WebSocAPI.callWebSocAPI(opts, function(result) {
for (let i = 0; i < result.length; i++) {
console.log(result[i].name);
}
})
The API serves its data in a hierarchical manner.
As shown above, the results are served to the callback in an array of schools. Each school
in the array contains department
s, which contains course
s, which contain section
s.
Field | Type | Notes |
---|---|---|
name | string | The name of the school like 'Donald Bren School of Information and Computer Science' |
comment | string | |
departments | array of Department objects | |
toString | function | Returns a JSON string representation of the object |
Field | Type | Notes |
---|---|---|
name | array | The array has two indices. Index 0: The code of the department like 'IN4MATX'. Index 1: The name of the department like 'Informatics'. |
comments | array | Comments that the department put on WebSoc. Index 0: The department comment. Rest of indices are course number range comments and course code range comments. |
courses | array of Course objects | |
toString | function | Returns a JSON string representation of the object |
Field | Type | Notes |
---|---|---|
name | array | The array has three indices. Index 0: Dept code, like 'I&C SCI'. Index 1: Course number, like '33'. Index 2: Course name, like 'INTERMEDIATE PRGRMG'. |
comment | string | |
prerequisiteLink | string | Link to the registrar's page where prerequistes are listed |
sections | array of Section objects | |
toString | function | Returns a JSON string representation of the object |
Field | Type | Notes |
---|---|---|
classCode | string | |
classType | string | |
sectionCode | string | |
units | string | |
instructors | array | Each instructor listed will have their own index. |
meetings | two-dimensional array | The array contains arrays which have two indices. Index 0: Meeting time, like 'MWF 9:00- 9:50'. Index 1: Meeting building, like 'ICS 174'. |
finalExamDate | string | |
maxCapacity | string | |
numCurrentlyEnrolled | array | The array has two indices. Index 0: Joint (total) enrollment. Index 1: This section's enrollment. If the class is not cross-listed, the two values will be the same |
numOnWaitlist | string | |
numRequested | string | |
numNewOnlyReserved | string | |
restrictions | string | The restriction code definitions can be found here |
status | string | |
comment | string | |
toString | function | Returns a JSON string representation of the object |