Fetch raw course data for a department from Stanford ExploreCourses API
Source:R/api.R
fetch_department_courses_raw.Rd
Makes a direct API call to retrieve all courses for a specific department and academic year from Stanford's ExploreCourses system. Returns the raw XML response without processing.
Arguments
- name
Character string. Department code (e.g.,
"CS"
for Computer Science). Must be a valid Stanford department code.- year
Character string or
NULL
. Academic year in formatYYYYYYYY
(e.g.,"20232024"
). IfNULL
, defaults to current academic year. Will be validated usingvalidate_academic_year()
.
Value
An xml2::xml_document object containing the raw courses XML. The XML structure includes:
Root
courses
element containing multiplecourse
elementsEach
course
element contains:Basic course information (ID, title, description)
Units information
Section data
Schedule information
Instructor details
Details
This function:
Validates the academic year format
Constructs the API URL using
COURSE_ENDPOINT
templateMakes the API request for course data
The API returns all active courses for the specified department, including detailed information about:
Course metadata (title, description, units)
Sections and components
Meeting schedules
Instructor information
Filters
The API request automatically includes filters for:
Department code match
Active courses only
See also
validate_academic_year()
for year format validationmake_api_request()
for the underlying API requestprocess_courses_xml()
for processing this XML datafetch_department_courses()
for the high-level interface