Skip to content

ConU Course Planner API

David Huculak edited this page Oct 18, 2017 · 26 revisions

Table of contents:

Our REST API

Under the hood, ConU Course Planner uses a set of HTTP web resources built for Concordia University useful for viewing individual courses' info & department-recommended course sequences, and validating/exporting user-defined course sequences.

This REST API is open to be used by anyone. If you find our tools useful, feel free to use this API to build an entirely separate application of your own!

Below lies a list of all of the endpoints (URLs) we provide, along with the expected request/response bodies. You can paste any of the curl commands from the examples into git bash on windows or the regular terminal on most linux distributions to test the API yourself. You could also use something like postman.

POST /api/courseinfo

By passing in a course code, you can get all of its relevant information such as its name, number of credits, pre-requisites, etc.

Request parameter(s):

code (required, string)

  • The course code whose info you want to retrieve
  • Must match the regex pattern: ^[A-Z]{4} [0-9]{3,4}$

Expected response format:

  • If the course does not exist, the server will respond with an empty object: {}

  • If the request succeeds, the response body will be an object containing many properties related to the course in question. We have defined the exact format of this object in a json-schema file which you can view here.

Example:

Request

curl -H "Content-Type: application/json" -X POST -d '{"code": "COMP 248"}' http://conucourseplanner.online/api/courseinfo

Response

{  
   "_id":"COMP 248",
   "code":"COMP 248",
   "name":"Object-Oriented Programming I",
   "credits":"3.5",
   "description":"Introduction to programming. Basic data types, variables, expressions, assignments, control flow. Classes, objects, methods. Information hiding, public vs. private visibility, data abstraction and encapsulation. References. Arrays. ",
   "lectureHours":"three hours per week",
   "tutorialHours":"two hours per week",
   "labHours":"one hour per week",
   "requirements":{  
      "prereqs":[],
      "coreqs":[  
         [  
            "MATH 204"
         ]
      ]
   }
}

POST /api/export

By passing in a course sequence object, you can get a downloadable link to an exported, human-readable version of it.

Request parameter(s):

courseSequenceObject (required, object)

  • The course sequence you want to export

  • We have defined the format of a course sequence object in a json-schema file which you can view here. An important difference to note is that each course object should contain the properties defined in the schema as well as name and credits properties. In the case that the entry is not a course, but is an orList (see courseSequenceSchema.json#definitions/orList), only courses inside this orList which have the isSelected property set to true will be put into the exported version of the sequence. Other properties in the courseSequenceObject will be ignored.

Expected response format:

  • If the request succeeds, the response body will be an object containing the following property:

exportPath (string)

  • Url from which the PDF version of the sequence can be exported. By replacing the file extension in the url from .pdf to .md, the url can be used to alternatively download a markdown version of the sequence.

Example:

Request (pretty version of request body can be viewed here)

curl -H "Content-Type: application/json" -X POST -d '{"yearList":[{"winter":{"isWorkTerm":"false","courseList":[{"isElective":"false","electiveType":"","name":"Object-Oriented Programming II","credits":"3.5","code":"COMP 249"},{"isElective":"true","electiveType":"Science","code":""}]},"fall":{"isWorkTerm":"false","courseList":[{"isElective":"false","electiveType":"","name":"Object-Oriented Programming I","credits":"3.5","code":"COMP 248"},{"isElective":"false","electiveType":"","name":"Professional Practice and Responsibility","credits":"1.5","code":"ENGR 201"}]},"summer":{"isWorkTerm":"true","courseList":[]}},{"winter":{"isWorkTerm":"false","courseList":[{"isElective":"false","electiveType":"","name":"Capstone Software Engineering Design Project","credits":"4","code":"SOEN 490"},[{"isElective":"false","electiveType":"","name":"Advanced Game Development","credits":"4","code":"COMP 476","isSelected":false},{"isElective":"false","electiveType":"","name":"Advanced Program Design with C++","credits":"4","code":"COMP 345","isSelected":true},{"isElective":"true","electiveType":"Program","code":"","isSelected":false}]]},"fall":{"isWorkTerm":"false","courseList":[]},"summer":{"isWorkTerm":"false","courseList":[]}}]}' http://conucourseplanner.online/api/export

Response

{"exportPath":"exports/1508362359876-152.pdf"}

After receiving this response, visiting the url http://www.conucourseplanner.online/exports/1508362359876-152.pdf will give you the pdf version of the exported sequence. Alternatively, replacing the url suffix from .pdf to .md and then visiting this new url (http://www.conucourseplanner.online/exports/1508362359876-152.md) yields the following text:

# My Course Sequence

### Fall 1

- COMP 248, Object-Oriented Programming I, 3.5 Credits
- ENGR 201, Professional Practice and Responsibility, 1.5 Credits

### Winter 1

- COMP 249, Object-Oriented Programming II, 3.5 Credits
- Science Elective

### Summer 1 (Work Term)

- No Courses

### Fall 2

- No Courses

### Winter 2

- SOEN 490, Capstone Software Engineering Design Project, 4 Credits
- COMP 345, Advanced Program Design with C++, 4 Credits

### Summer 2

- No Courses

to be continued...

Clone this wiki locally