Aeries API – Creating an Extract File using Node

This will be a quick example of how to create a simple export of student data from the Aeries SIS system using Node.js. To make things simple, we have created an NPM package that wraps the API into a helper to make calls for data easy. You can read more about that here, https://www.npmjs.com/package/aeriesjs.

The full Aeries API documentation can be found, here.

We are going to assume you have the basic understanding of how Node.js and NPM works, but if not, you can get started here, https://nodejs.org/en/docs/guides/.

To start out we’re going to take a simple Node application and add the aeriesjs and csv-write-stream package references to the package.json dependencies section.

{
    "name": "aeries-export",
    "version": "1.0.0",
    "description": "Aeries SIS Export Example",
    "main": "app.js",
    "author": {
        "name": "Josh Santomieri",
        "url": "https://www.santsys.com/"
    },
    "dependencies": {
        "aeriesjs": "^1.1.1",
        "csv-write-stream": "^2.0.0"
    }
}

Once we have that added, we can start building our code… In this example we’re going to create a students.csv file that will export a caret (^) delimited list of students. The student information we will be pulling will be Student ID, First Name, Last Name and Home Phone Number.

In this demo we’re going to use the Aeries API demo URL and certificate. In practice you should use your districts API Url and Certificate.

In our application code, lets name this file app.js, add the following:

'use strict';

let api = require('aeriesjs');
let csv = require('csv-write-stream');
let fs = require('fs');

var aeries = new api({
    certificate: '477abe9e7d27439681d62f4e0de1f5e1',
    url: 'https://demo.aeries.net/aeries/',
    verifyCerts: true
});

// Get all of the students at school 990
aeries.getStudents(990, function (err, students, code) {
    if (err) {
        console.log(err);
    }
    else {
        if (students && students.length > 0) {

            // Setup the file stream
            var writer = csv({
                separator: '^',
                newline: '\r\n',
                sendHeaders: true
            });
            writer.pipe(fs.createWriteStream('students.csv'));

            var count = 0;

            // loop through the students
            for (var i in students) {
                var s = students[i];
                if (s) {
                    // create a new object with the information we want
                    var studentOut = {
                        PermanentID: s.PermanentID,
                        FirstName: s.FirstName,
                        LastName: s.LastName,
                        HomePhone: s.HomePhone
                    };
										
                    // write the student to the file
                    writer.write(studentOut);
                    count++;
                }
            }

            // close the file stream
            writer.end();

            console.log('Wrote ' + count + ' students to file "students.csv".');
        }
        else {
            console.log('No students found.');
        }
    }
});

That’s it!

If you run that code using node app.js you will end up with a file named students.csv that contains the information we outlined above.

"PermanentID"^"FirstName"^"LastName"^"HomePhone"
"99000001"^"Robert"^"Aadasian"^"7775550214"
"99000002"^"Ruben"^"Aadasian"^"7775550214"
"99000003"^"Jonathan"^"Aguilar"^"7775557860"
"99000004"^"Tonya"^"Acres"^"7775555363"
"99000005"^"Stephanie"^"Aguilar"^"7775557860"
...

If you need to FTP this data anywhere, I always recommend using something like WinSCP to script out the FTP process. You can get more information on WinSCP here, https://winscp.net/.


Download this sample code here, aeriesjs-test.

To run, Install Node 8 or greater, extract the zip to a directory, then run npm update then node app.js.

C:\> cd aeriesjs-test

C:\aeriesjs-test> npm update
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN aeriesjs-test@1.0.0 No repository field.

+ csv-write-stream@2.0.0
+ aeriesjs@1.1.1
added 69 packages from 70 contributors in 6.795s

C:\aeriesjs-test> node app.js
Wrote 740 students to file "students.csv".

Gamdias Zeus Laser Gaming Mouse

Gamdias sent me out their Zeus laser gaming mouse to try out.

The Zeus gaming mouse is a very aggressively designed and highly adjustable mouse with laser precision tracking. One of the most interesting features of the Zeus mouse is that the sides of the mouse are adjustable via wheels on the bottom as well as ergonomic inserts that fit between the adjustable areas.

Read more

Gamdias Hermes RGB Keyboard

gamdias-hermes-rgb-and-box

I’ve taken a look at a couple of the Gamdias keyboard options out there and I have a new one to throw in the mix, the Gamdias Hermes RGB keyboard.

The Hermes RGB keyboard is a step up from the last Gamdias keyboard I reviewed, the Hermes 7-Color keyboard, and it really takes care of the primary thing I took issue with on it. The fact that it wasn’t able to be configured by the Gamdias Hera software (more information on that to follow)…

Read more

The Death of an EdgeRouter Lite

EdgeRouter-Lite-1

I’ve been happily using an EdgeRouter Lite (one of the first gen models) for just a touch over 3 years now. Everything worked amazingly well… Until one morning I woke up and my internet was down.

Everything looked normal, lights blinking, no warning lights, etc. After ruling out that my ISP was having issues, I decided to try and connect up my EdgeRouter via a browser. When I did this, I immediately knew there was an issue, I got a server 500 error. Not a DNS error, or some other HTTP error. So I power cycled the router, and same thing.

After digging out a console cable, I connected to the EdgeRouter and there is was… a Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,2) error.

Read more