9.6.2 • Published 6 years ago

katal v9.6.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

KAMAR API (project katal)

Greenkeeper badge Build Status npm version License Known Vulnerabilities Github Issues

NPM

🏫 📚 🎓 🥝 Unofficial node.js module for interfacing with the undocumented KAMAR API (project katal).

Install

npm i -S katal

Usage

var katal = require('katal');
var KAMAR = new katal({
  portal: 'student.kamar.nz'
});

The options can include:

ParameterDescriptionDefaultRequired
portalThe url of the portal, excluding https?:// and /api/api.php.Yes
yearThe year to use, otherwise current year is used.2017
TTthe Timetable Grid to lookup Timetable and Absences by. Leave blank unless you understand how grids work.year + 'TT'
UserAgentThe UserAgent to use for HTTP requests to the KAMAR portal."Katal API for KAMAR v???? (Cargo 3.69) [http://git.io/katal]"
timezoneThe timezone to use for timetables."Pacific/Auckland"
calendarThe calendar.json file got from KAMAR.getCalendar().Yes for timetable
useHTTPif true, HTTP will be used instead of HTTPS, which is a potential security risk.false
exponentialBackoffif true, requests failed due to timeout will be backed off exponentially.false
timeouttimeout for HTTP requests in ms.10000

Authenticating

KAMAR
  .authenticate({
    username: 15999,
    password: 'xxxxxxxx'
  })
  .then(function (credentials) {
    //execute other commands with credentials
  })
  .catch(function (error) {
    //deal with errors
  });

This yields an object containing username, key & authLevel.
authLevel is a number which distinguishes teachers and students. This is different for each school. (e.g. 0 = not logged in, 1 = students, 2 = primary caregiver, 3 = secondary caregiver, 10 = teacher, 23 = admin...)

Fetching Files

All methods return promises, so they can easily be linked together for complex queries.

KAMAR
  .get______(credentials) //credentials is the object returned by KAMAR.authenticate 
  .then(function (response) {
    //do stuff with response
  })
  .catch(function (error) {
    //deal with errors
  });

Methods

  • authenticate - see above
  • getAbsences - Note that Absence-Statistics are in a seperate file.
  • getAbsencesStatistics - Note that Absence by period are in a seperate file.
  • getTimeTable - Get this- & next week's Timetable.
  • getDetails - Get Personal Details about student.
  • getResults - Note that OfficialResults & NCEASummary are both in seperate files.
  • getNCEASummary - Note that OfficialResults & Results are both in seperate files.
  • getEndorsements - (OfficialResults) Note that NCEASummary & Results are both in seperate files.
  • getGroups - get Student Groups (co-curricular and school-based).
  • getAwards - get Student Awards.

  • searchStudents - Note that you need to be authenticated with a user who has permission to do this.

  • sendCommand - send a command to KAMAR - Note that more convenient methods exist for common files.

  • makevCardFromDetails - convert Details to vCard (VCF) format.
  • makeASCIItableWithAbsences - convert Absences to ASCII table (TXT) format.

See the Example Responses and the FileName rules (for the getFile query)

Example

var katal = require('katal'),
    KAMAR = new katal({ portal: 'student.kamar.nz' });

KAMAR
  .authenticate({ username: 'web.student', password: 'student' })
  .then(credentials => KAMAR.getAbsences(credentials))
  .then(absences => {
    console.log(absences);
  })
  .catch(error => console.error(error));

See example.js or try it in your browser on runkit.com

low-level KAMAR API

The low-level, XML-based API has been (unofficially) documented in the following file: KAMAR API Docs

9.6.2

6 years ago

9.6.1

6 years ago

9.6.0

6 years ago

9.5.0

6 years ago

9.4.13

6 years ago

9.4.12

6 years ago

9.4.11

6 years ago

9.4.10

6 years ago

9.4.9

6 years ago

9.4.8

6 years ago

9.4.7

6 years ago

9.4.6

6 years ago

9.4.5

6 years ago

9.4.4

6 years ago

9.4.3

6 years ago

9.4.2

6 years ago

9.4.1

6 years ago

9.4.0

6 years ago

9.3.0

7 years ago

9.2.1

7 years ago

9.2.0

7 years ago

9.1.0

7 years ago

9.0.2

7 years ago

9.0.1

7 years ago

9.0.0

7 years ago

8.0.9

7 years ago

8.0.8

7 years ago

8.0.7

7 years ago

8.0.6

7 years ago

8.0.5

7 years ago

8.0.4

7 years ago

8.0.3

7 years ago

8.0.1

7 years ago

8.0.0

7 years ago

7.2.6

7 years ago

7.2.5

7 years ago

5.4.4

8 years ago

5.4.3

8 years ago

5.4.2

8 years ago

5.4.1

8 years ago

5.4.0

8 years ago

5.2.2

8 years ago