Introduction
The Curriculum web service gives information about courses and classes. This information is derived from the CSUN catalog and SOLAR. The web service provides a gateway to access the information via a REST-ful API. The information is retrieved by creating a specific URI and giving values to filter the data. The information that is returned is a JSON object that contains a set of courses or classes; the format of the JSON object is as follows:
{
"api": "curriculum",
"status": "200",
"success": "true",
"version": "2.0",
"collection": "courses",
"courses": [
{
"subject": "COMP",
"catalog_number": "100",
"section_number": "06",
"title": "Computers: Their Impact and Use",
"course_id": 10080,
"description": "Not open to Computer Science majors. Introduction to the uses concepts techniques and terminology of computing. Places the possibilities and problems of computer use in historical economic and social contexts. Shows how computers can assist in a wide range of personal commercial and organizational activities. Typical computer applications including word processing spreadsheets and databases. (Available for General Education Lifelong Learning.) (IC)\n",
"units": "3",
"term": "Spring-2018"
},
{
"subject": "COMP",
"catalog_number": "100HON",
"section_number": "01",
"title": "COMPTRS/IMPCT-USE",
"course_id": 21107,
"description": null,
"units": "3",
"term": "Spring-2018"
},
...
]
}
How to use
- Generate the URI
Find the usage that fits your need. Browse through subcollections, instances and query types to help you craft your URI. - Provide the data
Use the URI to query your data. See the Usage Example session. - Show the results
Loop through the data to display its information. See the Usage Example session.
Collection
The collection URI allows the consumer to obtain a list of degree plans.
Examples
Degree PlansSubcollection
The subcollection URI allows the consumer to obtain a list of courses, classes, or degree plans that are
either part of a single program, a class name, or a set of degree plans.
Examples
Course Classes By Subject- https://www.csun.edu/web-dev/api/curriculum/2.0/classes/comp
- https://www.csun.edu/web-dev/api/curriculum/2.0/classes/comp-110
- https://www.csun.edu/web-dev/api/curriculum/2.0/terms/Spring-2015/classes/comp-110
- https://www.csun.edu/web-dev/api/curriculum/api/2.0/terms/2153/classes/comp-110
- https://www.csun.edu/web-dev/api/curriculum/2.0/courses/comp
- https://www.csun.edu/web-dev/api/curriculum/2.0/terms/Spring-2015/courses/comp
- https://www.csun.edu/web-dev/api/curriculum/2.0/terms/2153/courses/comp
- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/graduate
- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/undergraduate
Instance
The instance URI allows the consumer to obtain information
about a single course, class, or degree plan.
Examples
Single Class Single Course Single Degree Plan- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/561208B (Computer Science - Undergraduate Degree)
- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/561208A (STAR Computer Science - Undergraduate Degree)
- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/450503V (Deaf Studies - Undergraduate Degree)
- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/897665Y (Public Sector Management - FTF - Undergraduate Degree)
- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/561208R (Computer Science - Undergraduate Minor)
- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/561208M (Computer Science - Graduate Degree)
- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/561208T (Computer Science - Graduate Degree)
- https://www.csun.edu/web-dev/api/curriculum/2.0/plans/785845S (Mathematics - Graduate Minor)
Query
The query URI allows a consumer to obtain a list of courses or classes that meet a
particular criteria.
Examples
Non-Current Term Classes- https://www.csun.edu/web-dev/api/curriculum/2.0/terms/Spring-2015/classes/comp
- https://www.csun.edu/web-dev/api/curriculum/2.0/terms/Spring-2015/classes/comp-322
- https://www.csun.edu/web-dev/api/curriculum/2.0/terms/Spring-2015/classes?instructor=steven.fitzgerald@csun.edu
- https://www.csun.edu/web-dev/api/curriculum/2.0/terms/2153/classes?instructor=steven.fitzgerald@csun.edu
Usage Example
- JavaScript
-
// this example assumes jQuery integration for ease of use // and a <div> element with the ID of "course-results" // query all CompSci courses var url = 'https://www.csun.edu/web-dev/api/curriculum/2.0/courses/comp'; $(document).ready(function() { // perform a shorthand AJAX call to grab the information $.get(url, function(data) { // iterate over the returned courses var courses = data.courses; $(courses).each(function(index, course) { // append each course to the content of the element $('#course-results').append('<p>' + course.subject + ' ' + course.catalog_number + '</p>'); }); }); });
- PHP
-
// query all CompSci courses $url = 'https://www.csun.edu/web-dev/api/curriculum/2.0/courses/comp'; // call url, you can also use CURL or guzzle -> https://github.com/guzzle/guzzle $data = file_get_contents($url); // decode into an array $data = json_decode($data, true); // setup a blank array $course_list = []; // loop through results and add each courses's subject // and catalog number to course_list array (i.e. COMP 100) foreach($data['courses'] as $course){ $course_list[] = $course['subject'].' '.$course['catalog_number']; } print_r($course_list);
- Python
-
#python import urllib2 import json #query all CompSci courses url = u'https://www.csun.edu/web-dev/api/curriculum/2.0/courses/comp' #try to read the data try: u = urllib2.urlopen(url) data = u.read() except Exception as e: data = {} #decode into an array data = json.loads(data) #setup a blank array course_list = [] #loop through results and add each course's subject #and catalog number to course_list array (i.e COMP 100) for course in data['courses']: course_list.append(course['subject'] + ' ' + course['catalog_number']) print course_list
- Ruby
-
require 'net/http' require 'json' #query all CompSci courses source = 'https://www.csun.edu/web-dev/api/curriculum/2.0/courses/comp' #call data response = Net::HTTP.get_response(URI.parse(source)) #get body of the response data = response.body #put the parsed data puts JSON.parse(data)