npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-webuntis

v2.0.1

Published

The purpose of this node.js module is to make the communication with the Webuntis API easier

Downloads

2

Readme

WebUntis

The purpose of this node.js module is to make the communication with the Webuntis API easier. Please note that some of the requests require special rights that you may not possess.

Contents

Installation

npm install node-webuntis 

Overall

id| type ---|----- 1|class 2|teacher 3|subject 4|room 5|student

Methods

All methods are working with promises. In case you do not know how promises work, go and make yourself familiar with them (they very handy).

getSession

Parameters

  • schoolname
  • username
  • password

Usage

let session = await getSession(schoolname, username, password)

Returns

a Object containing the sessionId, personType, personId and klassId of the user which logged in.

{ 
  sessionId: '39DA6ABB504V1ERA682S5C3FC3CCE4DF5',
  personType: 5,
  personId: 244,
  klasseId: 19 
}

getTimetable

Parameters

  • sessionId
  • personType
  • personId
  • startDate (optional)
  • endDate (optional)

Usage

let timetable = await getTimetable(sessionId, personType, personId)
let timetable = await getTimetable(sessionId, personType, personId, startDate, endDate) //yyyymmdd

Returns

a array of lessons which should looks like this:

[ { id: 89,
    date: 20160509,
    startTime: 1210,
    endTime: 1300,
    kl:
     [ { id: 23,
         name: '4A',
         longname: 'Abt. Informationstechnologie' } ],
    te: [ { id: 18, name: 'Bob' } ],
    su: [ { id: 27, name: 'D', longname: 'DEUTSCH' } ],
    ro: [ { id: 9, name: '367', longname: 'Klasse' } ],
    activityType: 'Unterricht' },
    .
    .
    .
    ]

getCurrentWeekTimetable

Parameters

  • sessionId
  • personType
  • personId

Usage

let currentWeekTimetable = await getCurrentWeekTimetable(sessionId, personType, personId)

Returns

a array of lessons which should looks like this:

[ { id: 89,
    date: 20160509,
    startTime: 1210,
    endTime: 1300,
    kl:
     [ { id: 23,
         name: '4A',
         longname: 'Abt. Informationstechnologie' } ],
    te: [ { id: 18, name: 'Bob' } ],
    su: [ { id: 27, name: 'D', longname: 'DEUTSCH' } ],
    ro: [ { id: 9, name: '367', longname: 'Klasse' } ],
    activityType: 'Unterricht' },
    .
    .
    .
    ]

getTeachers

Parameters

  • sessionId

Usage

let teachers = await webuntis.getLatestImportTime(sessionId)

Returns

a array of teachers which should looks like this:

[{ id: 12,
    name: 'SMT',
    foreName: 'Alex',
    longName: 'Smith',
    title: '',
    active: true,
    dids: [ [Object], [Object] ] },
    .
    .
    .
    ]

getStudents

Parameters

  • sessionId

Usage

let students = await webuntis.getStudents(sessionId)

Returns

a array of students which should looks like this:

[{ id: 13,
    key: '1164725150374',
    name: 'smith.b01',
    foreName: 'Bob',
    longName: 'Smith',
    gender: 'male' },
    .
    .
    .
    ]

getClasses

Parameters

  • sessionId
  • schoolyearId

Usage

let classes = await Untis.getClasses(session.sessionId, schoolyearId)

Returns

a array of students which should looks like this:

[{ id: 85,
    name: '3ABM',
    longName: 'BM-Aufbaulehrgang (7S)',
    active: true,
    did: 1,
    teacher1: 3 },
    .
    .
    .
    ]

getSubjects

Parameters

  • sessionId

Usage

let subjects = await webuntis.getSubjects(sessionId)

Returns

a array of subjects which should looks like this:

[{ id: 251,
    name: 'GGP',
    longName: 'GEOGRAFIE, GESCHICHTE U. POL. BILD.',
    alternateName: '',
    active: true },
    .
    .
    .
    ]

getRooms

Parameters

  • sessionId

Usage

let rooms = await webuntis.getRooms(sessionId)

Returns

a array of rooms which should looks like this:

[{ id: 66,
    name: '364',
    longName: 'Klasse',
    active: true,
    did: 8,
    building: '' },
    .
    .
    .
    ]

getDepartments

Parameters

  • sessionId

Usage

let departments = await webuntis.getDepartments(sessionId)

Returns

a array of departments which should looks like this:

[{ id: 5, name: 'E', longName: 'ELEKTROTECHNIK' },
  { id: 2, name: 'IT', longName: 'INFORMATIONSTECHNOLOGIE' },
    .
    .
    .
    ]

getHolidays

Parameters

  • sessionId

Usage

let holidays = await webuntis.getHolidays(sessionId)

Returns

a array of holidays which should looks like this:

[{ id: 7,
    name: '26.10.',
    longName: 'Nationalfeiertag',
    startDate: 20181026,
    endDate: 20181026 },
    .
    .
    .
    ]

getTimeGrid

Parameters

  • sessionId

Usage

let timeGrid = await webuntis.getTimeGrid(sessionId)

Returns

a array of days with their timegrid which should looks like this:

[{ day: 2,
  timeUnits:
   [ { name: '1', startTime: 700, endTime: 750 },
     { name: '2', startTime: 750, endTime: 840 },
     { name: '3', startTime: 840, endTime: 930 },
     { name: '4', startTime: 930, endTime: 1020 },
     { name: '5', startTime: 1030, endTime: 1120 },
     { name: '6', startTime: 1120, endTime: 1210 },
    .
    .
    .
    ]

getCurrentSchoolYear

Parameters

  • sessionId

Usage

let schoolyear = await webuntis.getCurrentSchoolYear(sessionId)

Returns

a json object which should looks like this:

{ id: 1,
  name: '2018/2019',
  startDate: 20180903,
  endDate: 20190630 }

getSchoolYears

Parameters

  • sessionId

Usage

let schoolyear = await webuntis.getSchoolYears(sessionId)

Returns

a array of schoolyears which should looks like this:

[{ id: 1,
  name: '2018/2019',
  startDate: 20180903,
  endDate: 20190630 },
  .
  .
  .
  ]

getSubstitutions

Parameters

  • sessionId
  • startDate
  • endDate
  • departmentId (0 for all departments)

Usage

let schoolyear = await webuntis.getSubstitutions(sessionId, startDate, endDate, departmentId)

Returns

a array of substitutions which should looks like this:

[{ type: 'subst',
    lsid: 598,
    date: 20190911,
    startTime: 1120,
    endTime: 1210,
    kl: [ [Object], [Object] ],
    te: [ [Object], [Object], [Object] ],
    su: [ [Object] ],
    ro: [ [Object], [Object], [Object], [Object] ] },
  .
  .
  .
  ]

getTimetableWithAbsences

Parameters

  • sessionId
  • startDate
  • endDate

Usage

let schoolyear = await webuntis.getTimetableWithAbsences(sessionId, startDate, endDate) //yyyymmdd

Returns

a array of absences which should looks like this:

periodsWithAbsences:
   [{ date: 20190905,
      startTime: 750,
      endTime: 840,
      studentId: '91644720140681',
      subjectId: '',
      teacherIds: [ '' ],
      studentGroup: 'AM_5BHITM',
      user: '',
      checked: true }
      .
      .
      .
      ]

Logout

Parameters

  • sessionId

Usage

webuntis.Logout(sessionId)

Returns

a string which says if the logout was successful or not

Notice

I am not affiliated with Untis GmbH. Use this at your own risk.