First install with npm
or your favorite package manager:
npm install yalies
Import into your project:
const yalies = require('yalies');
// Alternative:
const API = require('yalies').API;
// If you choose this option, simply instantiate as `new API(...)` below.
Instantiate the API by passing your API key:
const api = new yalies.API('api_key')
You'll want to store your in an environment variable or config file of some sort. At any rate, don't commit it to GitHub! :)
Finally, use the people
method to query the API, passing an object containing any request criteria you wish, as explained in the Yalies API documentation.
api.people({
query: 'John',
filters: {
school_code: ['YC'],
college: [
'Grace Hopper',
'Davenport'
],
year: [2023, 2024],
floor: 3,
leave: [true]
},
page: 1,
page_size: 10
}).then(people => {
for (let person of people) {
console.log(person.netid);
}
});
Feel free to open an issue if you need help!