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".

Reolink NVR and RLC-410 PoE 4MP Cameras

I’ve been hunting for a security camera setup for my home for quite some time, doing a ton of research, looking at multiple brands, etc. One thing that kept coming up is that a lot of the specs were very close to the same on many of the products in my price range.

There are obviously certain aspects that are different from each brand, like mounting options, hardware, accessories, camera options, and of course cost. But in a lower cost, “non-professional” system, your options tend to blend together across brands. There are also not a lot of power over ethernet (PoE) cameras out there in the lower price points. Especially not ones that are available in a full system configuration with an NVR, etc.

The TL;DR:

The main brands that I narrowed down to was Hikvision and Reolink. And the real deciding factor in the end was the cost of the NVR that was available for the selected system (I didn’t want to do a roll your own system). The Reolink system with 4 cameras and a NVR with a 2TB hard drive came in at $479.99 USD. For Hikvision, the just the NVR with a 2TB drive was $396.00 USD. So the Reolink system won.

Read more

Microsoft: Query Azure Endpoints

During a recent project where I was needing to integrate with a Microsoft Azure Intune environment to query for endpoint information, I was having a heck of a time getting proper tokens for use with the Graph API to query for endpoints. Here is the short and sweet to getting API tokens to work correctly and getting endpoint lists from the Graph API.

Read more

Osprey Ozone 46 Travel Pack

Osprey-Ozone-46-Front

I recently purchased the Osprey Ozone 46 travel pack as an alternative to some other travel packs I had been using, mainly to get a little more space for winter gear.

In the past I had been using a Mountainsmith Parallax camera backpack for most of my travels and it’s worked well. But over the years I’ve started bringing less and less equipment with me and needing more space for clothing and other accessories. The Parallax has about 1880 cu. in. of storage space while the Ozone 46 has 2807 cu. In., so the extra space makes things great for stuffing in things like extra jackets, rain pants, etc. Items that I really had to pin to the outside of the Parallax to get it all to fit.

The Parallax has become my short travel, or day-to-day carry around bag for camera equipment as I still love the padding and customization available with it. And for longer trips, I still use the interior travel case that came with the Parallax for my Nikon D810 camera, I just don’t bring extra lenses or things like that, as I’ve found I don’t use them when doing most of my travel photography.

Read more

Node RADIUS Server Example

Recently I’ve been doing a lot of small projects that involve RADIUS authentication on devices and have had to build multiple RADIUS auth servers for testing communication and integrating with 3rd party systems.

A very cool thing about being able to spin up a simple RADIUS server is you can create a basic server then hook it to your favorite authentication service and/or threat detection service. So, for example, let’s say you want to authenticate a user against a local repository or LDAP directory, then verify that the user is valid in your enterprise threat detection system, you can do that by simply adding in another validation step.

It also gives you the option to point servers at your custom application and send login requests to it and verify what your clients are sending, etc. This is great for debugging hardware that may not have the best internal logging. The options are really endless.

Read more

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