3.0.0 • Published 1 year ago

websoc-api v3.0.0

Weekly downloads
32
License
MIT
Repository
-
Last release
1 year ago

Introduction

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.

Installation

Requires NodeJS 12

$ npm install --save websoc-api

Documentation

Retrieving class listings

async callWebSocAPI(options)

To retrieve class listings, you just call the function you imported, callWebSocAPI and pass in an object-literal that configures what you're looking for, such as department, term, division etc.

options

Descriptions found here

NameFormattingNotes
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
departmentList of available departments to search available in file depts.txtExample: 'I&C SCI' Default: ' 'Must specify at least one of department, GE, courseCodes, or instructorName
courseNumberAny valid course number or rangeExample: '32A' OR '31-33' Default: ' '
division['ALL'|'LowerDiv'|'UpperDiv'|'Graduate']Example: 'LowerDiv' Default: 'ALL'
sectionCodesAny valid 5-digit course code or rangeExample: "36531" OR "36520-36536" Default: ' 'Must specify at least one of department, GE, courseCodes, or instructorName
instructorNameAny valid instructor last name or part of last nameExample: 'Thornton' Default: ' 'Enter last name only
courseTitleAny textExample: 'Intro' Default: ' '
sectionType['ALL'|'ACT'|'COL'|'DIS'|'FLD'|'LAB'|'LEC'|'QIZ'|'RES'|'SEM'|'STU'|'TAP'|'TUT']Example: 'LAB' Default: 'ALL'
unitsAny 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 daysExample: 'T' OR 'MWF' Default: ' '
startTimeAny time in 12 hour formatExample: '10:00AM' OR '5:00PM' Default: ' 'Only enter sharp hours
endTimeAny time in 12 hour formatExample: '12:00AM' OR '6:00PM' Default: ' 'Only enter sharp hours
maxCapacityExact 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 retrievedExample:'SkipFullWaitlist' Default: 'ANY'
cancelledCourses['Exclude'|'Include'|'Only']Example: 'Include' Default: 'EXCLUDE'
buildingAny valid building codeExample: 'DBH' Default: ' 'The value is a building code. Building codes found here: https://www.reg.uci.edu/addl/campus/
roomAny valid room numberExample: '223' Default: ' 'You must specify a building code if you specify a room number

Usage

// Import the module
import { callWebSocAPI } from 'websoc-api';

//Specify our search parameters
const opts = {
    term: '2019 Fall',
    GE: 'GE-2',
    instructorName: 'Pattis'
}

// Call the module, and when the promise resolves, print out the JSON returned
const result = await callWebSocAPI(opts);
console.log(output);

Using retrieved data

The API serves its data in a hierarchical manner. The top level object is schools. Each school in the array contains departments, which contains courses, which contain sections.

School

FieldTypeNotes
schoolNamestringThe name of the school like 'Donald Bren School of Information and Computer Science'
schoolCommentstring
departmentsarray of Department objects

Department

FieldTypeNotes
deptNamestringThe name of the department like 'Informatics'.
deptCodestringThe code of the department like 'IN4MATX'.
deptCommentstringComments that the department put on WebSoc.
coursesarray of Course objects
sectionCodeRangeCommentsarrayComments associated with a range of sections.
courseNumberRangeCommentsarrayComments associated with a range of courses.

Course

FieldTypeNotes
courseNumberstringCourse number, like '33'.
courseTitlestringCourse title, like 'INTERMEDIATE PRGRMG'.
courseCommentstring
prerequisiteLinkstringLink to the registrar's page where prerequistes are listed
sectionsarray of Section objects

Section

FieldTypeNotes
sectionCodestring
sectionTypestring
sectionNumstring
unitsstring
instructorsarray
meetingsarray of objects with fields "days", "time" and "bldg"If the meeting is "TBA", the field "days" will be "TBA" and the others will be empty strings.
finalExamstring
maxCapacitystring
numCurrentlyEnrolledobject with fields "totalEnrolled" and "sectionEnrolled"When a course is crosslisted, it will have both fields filled, otherwise, "sectionEnrolled" will be an empty string.
numOnWaitliststring
numRequestedstring
numNewOnlyReservedstring
restrictionsstringThe restriction code definitions can be found here
statusstring
sectionCommentstring
3.0.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

4 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago