Skip to content

Latest commit

 

History

History
81 lines (56 loc) · 2.92 KB

.README.header.md

File metadata and controls

81 lines (56 loc) · 2.92 KB

ut-registration-api

Optimized interface for UT Austin's registration client written in TypeScript.

Check out the notes I wrote for myself while reverse engineering this API here: https://gist.github.com/An-GG/9ef0bfb88744a8183ec3d5faf1a39471

This interface is a one-to-one translation of all the endpoints I have encountered and documented with minor convenience abstractions.

  • Zero browser overhead: Registration methods are implemented as pure fetch GET/POST requests and consist of only a single outgoing transaction, so you don't need to wait for the server to respond before you begin making requests.
  • Parallelize requests: Stockpile many nonces in advance and use them all at once, even if the server is unresponsive.

Install

Add to your project:

$ npm i ut-registration-api

Example

let { RegistrationSession } = require('ut-registration-api')

async function main() {
    
    let session = new RegistrationSession(2023, 'Spring');
    await session.login();

    let ris = await session.getRIS();

    // Single time acknowledgement is required only once for each semester.
    // This is the page that asks you to check the box next to:
    // 'I acknowledge that the courses for which I am registering are consistent with my degree plan.'
    //
    // You need to call this manually at least once each semester, or requests will silently fail.
    await session.singleTimeAcknowledgement();

    await session.addCourse(11111);
}
main();

NOTE: Registration methods throw an error when they are unsuccessful. Assume method calls that don't throw completed successfully.

When running the example, addCourse throws because 11111 isn't a valid course number.

$ node example.js
.../node_modules/ut-registration-api/dist/api.js:390
                throw new Error(r.dom('span.error').parent().text());
Error:         
        Add was unsuccessful because:
                The unique number entered is not a valid number.
                (Code:0095)
...

What is cookies_from_authenticated_session ??

RegistrationSession cannot authenticate you using your EID/password directly because this is non-trivially complicated. Instead, you must provide cookies from an already authenticated session.

Update: This package now incorporates ut-auth-utils, and can create an authenticated session to fetch cookies on its own. The login() method will launch a Chromium window to login with your EID / password graphically.

Session cookies are saved to /tmp by default, so you shouldn't need to login manually every time.

TypeScript Usage

import { RegistrationSession } from 'ut-registration-api'

async function main() {
    let session = new RegistrationSession(2023, 'Spring');
    await session.login();

    let ris = await session.getRIS();
    let classes = await session.getClassListing();
}
main();

API