This is a simple API that scrapes and serves Monash University handbook. It is written in Go and uses MongoDB and Redis for storing and caching handbook data.
This was created as a personal project for a course mapper and timetabler. However, the timetabler is now a separate project and the course mapper is not yet implemented.
This repository contains the scraper and API needed to fetch handbook data, which would be useful in creating a course mapper.
The timetabler is available on timetabler.jasondev.me.
A simple API, purely written in Go, that scrapes and serves Monash University handbook and timetable data.
There are two main parts of this API:
- Handbook Data: Scrapes and serves detailed information about units, courses, and areas of study, including prerequisites and enrolment rules checking.
The handbook data can be used with no setup; just run the server and start querying. It depends on handbook.monash.edu
- Install Go: https://golang.org/doc/install
- Install MongoDB: https://docs.mongodb.com/manual/installation/
- Install Redis: https://redis.io/download
- Install dependencies:
go mod download
- Set up environment variables, as shown in sample.env
6Start the server:
go run main.go
- Done! The server will run on port 8080. You can test it by visiting
http://localhost:8080/v1/healthor by testing the API routes using Postman.
- Install Docker: https://docs.docker.com/get-docker/
- Install Docker Compose: https://docs.docker.com/compose/install/
- Set up environment variables, as shown in sample.env
- Start the server:
docker-compose up
- Endpoint:
/v1/:year/units/:code - Method:
GET - Description: Retrieves detailed information about a specific unit
- Parameters:
year: The year of the handbook, ranging from2020to2025, orcurrentcode: The unit code (e.g.,FIT3175)
- Examples:
curl 'localhost:8080/v1/2025/units/FIT2004'
curl 'localhost:8080/v1/current/units/FIT3175'- Endpoint:
/v1/:year/courses/:code - Method:
GET - Description: Retrieves detailed information about a specific course
- Parameters:
year: The year of the handbook, ranging from2020to2025, orcurrentcode: The course code (e.g.,C2000orS2000)
curl 'localhost:8080/v1/2024/courses/C2000'- Endpoint:
/v1/:year/aos/:code - Method:
GET - Description: Retrieves detailed information about a specific area of study (e.g. minor, major)
- Parameters:
year: The year of the handbook, ranging from2020to2025, orcurrentcode: The area of study code (e.g.,SFTWRDEV07)
curl 'localhost:8080/v1/current/aos/SFTWRDEV07'- Endpoint:
/v1/:year/units/:code/check - Method:
POST - Description: Checks if a student meets the prerequisites for a given unit
- Parameters:
year: The year of the handbook, ranging from2020to2025, orcurrentcode: The unit code (e.g.,FIT3175)
- Request Body:
- A JSON array of completed units, each with a
codefield - Example:
[ {"code": "FIT1045"}, {"code": "FIT2004"} ]
- A JSON array of completed units, each with a
- Response:
- A JSON object with:
met_requisites: boolean indicating if requirements are metmessage: array of unmet requisites messageswarning: enrolment rule warnings, if any. Usually appears in first year units, where they warn about the minimum VCE scores. This basically represents mini-enrolment rules but we can't parse them into a data structure.
- Example:
{ "met_requisites": true, "message": [], "warning": "Some warning text" }
- A JSON object with:
- Sample Usage
curl 'localhost:8080/v1/2024/units/FIT3152/check' \
--header 'Content-Type: application/json' \
--data ' [
{"code": "FIT1045"},
{"code": "FIT2004"}
]'Response:
{
"message": [
"Requires one of: FIT1006 or ETC1010 or STA1010 or ETC1000 or ETW1000 or ETF1100 or ETW1010 or FIT2086 or ETW2111",
"Requires one of: FIT2094 or FIT3171"
],
"met_requisites": false,
"warning": ""
}- Endpoint:
/v1/handbook/search_url - Method:
GET - Description: Retrieves the current handbook search API URL
- Response:
- A JSON object with the
urlfield - Example usage:
curl http://localhost:8080/v1/handbook/search_url
{ "url": "api-ap-southeast-2.prod.courseloop.com" }
- A JSON object with the
- Endpoint:
/v1/health - Method:
GET - Description: Simple health check endpoint
- Response:
- A JSON object with
statusfield - Example:
{"status": "ok"}
- A JSON object with