An API client library for interacting with Aspen, a Student Information System (SIS) created by Follett and used in schools around the U.S.
This package is a work-in-progress. Some features may be missing or not fully fleshed-out!
aspen-api
can be installed from NPM with your node package manager of choice:
npm install aspen-api
yarn install aspen-api
pnpm install aspen-api
Note:
aspen-api
is ESM, rather than CommonJS. That means that if you want to use it in a project written in CommonJS, you need to either convert your project to ESM, or use theimport()
function.
You can access Aspen through a single class. You need to initiate it using your 'district ID.' All Aspen instances are hosted at a subdomain of myfollett.com, though some districts might have students use a different domain, for example, aspen.dcps.dc.gov -> dcps.myfollett.com.
import Aspen from "aspen-api";
const aspen = new Aspen("dcps");
Once you've created an Aspen
object, you need to log in:
// store your login however you want!
const username = process.env.USERNAME
const password = process.env.PASSWORD
await aspen.login({ username, password })
Everything in aspen-api
is stored in a central Aspen
class.
Constructs a new Aspen
object. The id
is the subdomain of <id>.myfollett.com
. Cookies can be passed in using an array of Cookie
objects. aspen-api
uses tough-cookie
for managing cookies. If you want to save an Aspen session and reconstruct it later, this is the recommended way to do it.
import Aspen from "aspen-api";
const aspen = new Aspen("dcps");
// store your login however you want!
const username = process.env.USERNAME;
const password = process.env.PASSWORD;
await aspen.login({ username, password });
Returns: Promise<ClassInfo[]>
Gets a list of all the classes, along with info about them.
const classes = await aspen.getClasses();
Returns: Promise<ClassData>
Gets data about a class, including grades. The token
is a sort of identifier for the class, it comes in the data from the getClasses
function.
// grab this earlier from getClasses()
const token = // ...
const mathClass = await getClass(token);
Returns: Promise<Assignment[]>
Gets the list of assignments from a class.
// grab this earlier from getClasses()
const token = // ...
const mathAssignments = await getAssignments(token);
Returns: Promise<Schedule>
Gets the current schedule of the current student.
Returns: Promise<Cookie[]>
Gets a list of all the stored cookies.
See types.ts
.