/PurdueApi

This provides the core API for Purdue.io including CatalogSync, CatalogApi, and the ASP Web API endpoints.

Primary LanguageC#MIT LicenseMIT

Purdue.io

An open API for Purdue University's course catalog and scheduling system.

Purdue.io was started in 2015 as a CS Senior Design project with the goal of improving access to Purdue's course catalog data. It is still maintained and functional today, years later!

Querying

Public API Instance

There is a public instance of the Purdue.io API available at api.purdue.io

OData Queries

Purdue.io allows you to construct OData queries that you can run via RESTful HTTP calls to query for course catalog information. For example, this URL

http://api.purdue.io/odata/Course?$filter=contains(Title, 'Algebra')

will return this:

{
    "@odata.context": "http://api.purdue.io/odata/$metadata#Course",
    "value": [
        {
            "Id": "893b204e-616d-42bb-bf7b-49689878bdac",
            "Number": "51500",
            "SubjectId": "7c0ec82f-fe5d-466a-8816-db7d85a79ee8",
            "Title": "Numerical Linear Algebra",
            "CreditHours": 3,
            "Description": "Students registering for this course must contact the Engineering Professional Education office – http://proed.purdue.edu"
        },
        {
            "Id": "ea42d0c8-f3f0-467c-9202-5ab2ed72e765",
            "Number": "50300",
            "SubjectId": "939c74b7-d2d5-4a4c-958e-c4d008c256b6",
            "Title": "Abstract Algebra",
            "CreditHours": 3,
            "Description": ""
        },
        [...]

What kind of queries can I run?

Check out the wiki! You can run the sample queries there through the query tester at http://api.purdue.io/.

Building and Running

Tools

Purdue.io is written in C# on .NET 8. It will run natively on most major architectures and operating systems (Windows, Linux, Mac OS).

Entity Framework is used to communicate with an underlying database provider. Currently, Purdue.io supports PostgreSQL and SQLite, but additional providers could be added with minimal effort.

To start developing locally, install the .NET SDK.

Install .NET SDK

CatalogSync

CatalogSync is the process used to pull course data from MyPurdue and synchronize it to a relational database store.

CatalogSync accepts options to configure which database provider and connection it uses.

Additional flags are available to configure CatalogSync behavior. Use the --help flag for more information.

cd src/CatalogSync

# To sync to default SQLite file purdueio.sqlite
dotnet run

# To sync to a specific SQLite file
dotnet run -- -d Sqlite -c "Data Source=path/to/file.sqlite"

CatalogSync will begin synchronizing course catalog data to purdueio.sqlite.

To sync to another database provider, use the -d and -c options to specify a database provider and connection string:

# To sync to a local PostgreSQL instance:
dotnet run -- -d Npgsql -c "Host=localhost;Database=purdueio;Username=purdueio;Password=purdueio"

API

The API project contains the ASP web service used to provide the OData API.

To start the API, update appsettings.json with the database provider and connection string used with CatalogSync, and dotnet run.

The web service will be available by default at http://localhost:5000.

Contributing

See the contributing wiki page!