UBC Explorer API and EndPoints

The API provided below requires no API key access. For specific user data, user authentication is required. The url is https://ubcexplorer.io/


Course Data EndPoints


/getAllCourses
Description: Retrieves a list of all courses offered by UBC that is shown on UBC's calendar.

API Response
Returns a JSON array of all courses
[
  {
    "preq": [],
    "creq": [],
    "depn": [
      "FNEL 102"
    ],
    "_id": "5eb76d6f8ade8b27172d5236",
    "dept": "FNEL",
    "code": "FNEL 101",
    "name": "Introduction to a Salish Language I",
    "cred": null,
    "desc": "Course Description",
    "link": "https://courses.students.ubc.ca/cs/courseschedule?pname=subjarea&tname=subj-course&dept=FNEL&course=101"
  }
]

Examples of API Calls
https://ubcexplorer.io/getAllCourses

/getCourseInfo/:code
Description: Query a specific course from courses database.

API Response (For a MATH 210 search)
{
  "preq": [
    "MATH 101",
    "MATH 103",
    "MATH 105",
    "MATH 121",
    "SCIE 001"
  ],
  "creq": [
    "MATH 215",
    "MATH 255",
    "MATH 256",
    "MATH 258",
    "MATH 152",
    "MATH 221",
    "MATH 223"
  ],
  "depn": [
    "CPSC 203",
    "CPSC 330",
    "EOSC 442"
  ],
  "_id": "5eb76d718ade8b27172d6363",
  "dept": "MATH",
  "code": "MATH 210",
  "name": "Introduction to Mathematical Computing",
  "cred": 3,
  "desc": "Course Description",
  "prer": "One of MATH 101, MATH 103, MATH 105, MATH 121, SCIE 001.",
  "crer": "One of MATH 215, MATH 255, MATH 256, MATH 258 and one of MATH 152, MATH 221, MATH 223.",
  "link": "https://courses.students.ubc.ca/cs/courseschedule?pname=subjarea&tname=subj-course&dept=MATH&course=210"
}

Error Responses:
"Course not found"
"An error has occurred:" + error

Examples of API Calls
https://ubcexplorer.io/getCourseInfo/[DEPT]%20[CODE]
https://ubcexplorer.io/getCourseInfo/MATH%20210

/searchAny/:code
Description: Returns the top 8 course objects which matches a request passed in and the course code.

API Response
Same schema format as/getCourseInfo/:code

Error Responses:
"Course not found"
"An error has occurred:" + error

Examples of API Calls
Search CP: https://ubcexplorer.io/searchAny/CP
Search CPSC: https://ubcexplorer.io/searchAny/CPSC
Search CPSC: https://ubcexplorer.io/searchAny/CPSC%20310


User Data EndPoints


/userdata
Description: Retrieves the authenticated user's entire profile. A user profile consists of courses, _id, email, firstName, lastName, and picture.
Note:User authentication is required.

API Response
[
  {
    "courses": [
      {
        "name": "2019W1",
        "courses": [
          {
            "code": "CPSC 110",
            "name": "Computation, Programs, and Programming",
            "desc": "Course Description",
            "cred": 4,
            "tag": "Core Course",
            "term": "2019W1"
          }
        ]
      }
    ],
    "_id": "id",
    "email": "email@gmail.com",
    "firstName": "FirstName",
    "lastName": "LastName",
    "__v": "ver #",
    "picture": "profile picture url"
  }
]

Examples of API Calls
https://ubcexplorer.io/userdata


/downloadUserData
Description: Download your user data as a JSON file.
Note:User authentication is required.

Examples of API Calls
https://ubcexplorer.io/downloadUserData


/getCourses
Description: Retrieves the authenticated user's list of courses.
Note:User authentication is required.

API Response
[
  {
    "name": "2019W1",
    "courses": [
      {
        "code": "CPSC 110",
        "name": "Computation, Programs, and Programming",
        "desc": "Course Description",
        "cred": 4,
        "tag": "Core Course",
        "term": "2019W1"
      },
      {
        "code": "CPSC 121",
        "name": "Models of Computation",
        "desc": "Course Description",
        "cred": 4,
        "tag": "Core Course",
        "term": "2019W1"
      }
    ]
  },
  {
    "name": "2019W2",
    "courses": [
      {
        "code": "MATH 200",
        "name": "Calculus III",
        "desc": "Course Description",
        "cred": 3,
        "tag": "Exemption Replacement",
        "term": "2019W2"
      },
      {
        "code": "CPSC 210",
        "name": "Software Construction",
        "desc": "Course Description",
        "cred": 4,
        "tag": "Core Course",
        "term": "2019W2"
      }
    ]
  }
]

Examples of API Calls
https://ubcexplorer.io/getCourses