WebUntis

WebUntis

WebUntis API Class

Constructor

new WebUntis(school, username, password, baseurl, identityopt, disableUserAgentopt)

Source:
Parameters:
Name Type Attributes Default Description
school string

The school identifier

username string
password string
baseurl string

Just the host name of your WebUntis (Example: mese.webuntis.com)

identity string <optional>
"Awesome"

A identity like: MyAwesomeApp

disableUserAgent boolean <optional>
false

If this is true, axios will not send a custom User-Agent

Methods

(static) convertUntisDate(date, baseDateopt) → {Date}

Converts the untis date string format to a normal JS Date object

Source:
Parameters:
Name Type Attributes Default Description
date string

Untis date string

baseDate Date <optional>
new Date()

Base date. Default beginning of current day

Returns:
Type:
Date

(static) convertUntisTime(time, baseDateopt) → {Date}

Convert a untis time string to a JS Date object

Source:
Parameters:
Name Type Attributes Default Description
time string | number

Untis time string

baseDate Date <optional>
new Date()

Day used as base for the time. Default: Current date

Returns:
Type:
Date

(async) _getJWT() → {Promise.<String>}

Get JWT Token

Source:
Returns:
Type:
Promise.<String>

convertDateToUntis(date) → {String}

Convert a JS Date Object to a WebUntis date string

Source:
Parameters:
Name Type Description
date Date
Returns:
Type:
String

(async) getAbsentLesson(rangeStart, rangeEnd, excuseStatusIdopt, validateSessionopt) → {Promise.<Absences>}

Returns all the Lessons where you were absent including the excused one!

Source:
Parameters:
Name Type Attributes Default Description
rangeStart Date
rangeEnd Date
excuseStatusId Integer <optional>
-1
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Absences>

(async) getClasses(validateSessionopt, schoolyearId) → {Promise.<Array>}

Get all classes known by WebUntis

Source:
Parameters:
Name Type Attributes Default Description
validateSession boolean <optional>
true
schoolyearId number
Returns:
Type:
Promise.<Array>

(async) getDepartments(validateSessionopt) → {Promise.<Array>}

Get all departments known by WebUntis

Source:
Parameters:
Name Type Attributes Default Description
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getExamsForRange(rangeStart, rangeEnd, klasseId, withGrades, validateSessionopt) → {Promise.<void>}

Get Exams for range

Source:
Parameters:
Name Type Attributes Default Description
rangeStart Date
rangeEnd Date
klasseId Number
withGrades boolean false
validateSession boolean <optional>
true
Returns:
Type:
Promise.<void>

(async) getHolidays(validateSessionopt) → {Promise.<Array>}

Get all holidays known by WebUntis

Source:
Parameters:
Name Type Attributes Default Description
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getHomeWorkAndLessons(rangeStart, rangeEnd, validateSessionopt) → {Promise.<void>}

Source:
Parameters:
Name Type Attributes Default Description
rangeStart Date
rangeEnd Date
validateSession boolean <optional>
true
Returns:
Type:
Promise.<void>

(async) getHomeWorksFor(rangeStart, rangeEnd, validateSessionopt) → {Promise.<Array>}

Source:
Parameters:
Name Type Attributes Default Description
rangeStart Date
rangeEnd Date
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getInbox() → {Promise.<Object>}

Get Inbox

Source:
Returns:
Type:
Promise.<Object>

(async) getLatestImportTime(validateSessionopt) → {Promise.<Number>}

Get the time when WebUntis last changed it's data

Source:
Parameters:
Name Type Attributes Default Description
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Number>

(async) getLatestSchoolyear(validateSessionopt) → {Promise.<{name: String, id: Number, startDate: Date, endDate: Date}>}

Get the latest WebUntis Schoolyear

Source:
Parameters:
Name Type Attributes Default Description
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<{name: String, id: Number, startDate: Date, endDate: Date}>

(async) getNewsWidget(date, validateSessionopt) → {Promise.<Object>}

Get News Widget

Source:
Parameters:
Name Type Attributes Default Description
date Date
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Object>

see index.d.ts NewsWidget

(async) getOwnClassTimetableFor(date, validateSessionopt) → {Promise.<Array>}

Get the Timetable of your class for the given day Note: You can't use this with anonymous login

Source:
Parameters:
Name Type Attributes Default Description
date Date
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getOwnClassTimetableForRange(rangeStart, rangeEnd, validateSessionopt) → {Promise.<Array>}

Get the Timetable of your class for a given Date range Note: You can't use this with anonymous login

Source:
Parameters:
Name Type Attributes Default Description
rangeStart Date
rangeEnd Date
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getOwnClassTimetableForToday(validateSessionopt) → {Promise.<Array>}

Get the Timetable of your class for today Note: You can't use this with anonymous login

Source:
Parameters:
Name Type Attributes Default Description
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getOwnTimetableFor(date, validateSessionopt) → {Promise.<Array>}

Get your own Timetable for the given day Note: You can't use this with anonymous login

Source:
Parameters:
Name Type Attributes Default Description
date Date
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getOwnTimetableForRange(rangeStart, rangeEnd, validateSessionopt) → {Promise.<Array>}

Get your own timetable for a given Date range Note: You can't use this with anonymous login

Source:
Parameters:
Name Type Attributes Default Description
rangeStart Date
rangeEnd Date
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getOwnTimetableForToday(validateSessionopt) → {Promise.<Array>}

Get your own Timetable for the current day Note: You can't use this with anonymous login

Source:
Parameters:
Name Type Attributes Default Description
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getOwnTimetableForWeek(date, formatIdopt, validateSessionopt) → {Promise.<Array.<WebAPITimetable>>}

Get the timetable for the current week for the current element from the web client API.

Source:
Parameters:
Name Type Attributes Default Description
date Date

one date in the week to query

formatId Number <optional>
1

set to 1 to include teachers, 2 omits the teachers in elements response

validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array.<WebAPITimetable>>

(async) getPdfOfAbsentLesson(rangeStart, rangeEnd, validateSessionopt, excuseStatusIdopt, latenessopt, absencesopt, excuseGroupopt) → {String}

Returns a URL to a unique PDF of all the lessons you were absent

Source:
Parameters:
Name Type Attributes Default Description
rangeStart Date
rangeEnd Date
validateSession boolean <optional>
true
excuseStatusId Integer <optional>
-1
lateness boolean <optional>
true
absences boolean <optional>
true
excuseGroup boolean <optional>
2
Returns:
Type:
String

URL

(async) getRooms(validateSessionopt) → {Promise.<Array>}

Get all known rooms by WebUntis

Source:
Parameters:
Name Type Attributes Default Description
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getSchoolyears(validateSessionopt) → {Promise.<{name: String, id: Number, startDate: Date, endDate: Date}>}

Get all WebUntis Schoolyears

Source:
Parameters:
Name Type Attributes Default Description
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<{name: String, id: Number, startDate: Date, endDate: Date}>

(async) getStatusData(validateSessionopt) → {Promise.<Array>}

Get all status data known by WebUntis

Source:
Parameters:
Name Type Attributes Default Description
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getStudents(validateSessionopt) → {Promise.<Array>}

Get all known students by WebUntis

Source:
Parameters:
Name Type Attributes Default Description
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getSubjects(validateSessionopt) → {Promise.<Array>}

Get all known Subjects for the current logged in user

Source:
Parameters:
Name Type Attributes Default Description
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getTeachers(validateSessionopt) → {Promise.<Array>}

Get all known teachers by WebUntis

Source:
Parameters:
Name Type Attributes Default Description
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getTimegrid(validateSessionopt) → {Promise.<Array>}

Get the timegrid of current school

Source:
Parameters:
Name Type Attributes Default Description
validateSession boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getTimetableFor(date, id, type, validateSessionopt) → {Promise.<Array>}

Get the timetable for a specific day for a specific element.

Source:
Parameters:
Name Type Attributes Default Description
date Date
id number
type WebUntisElementType
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getTimetableForRange(rangeStart, rangeEnd, id, type, validateSessionopt) → {Promise.<Array>}

Get the timetable for a given Date range for specific element

Source:
Parameters:
Name Type Attributes Default Description
rangeStart Date
rangeEnd Date
id number
type WebUntisElementType
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getTimetableForToday(id, type, validateSessionopt) → {Promise.<Array>}

Get the timetable of today for a specific element.

Source:
Parameters:
Name Type Attributes Default Description
id number
type WebUntisElementType
validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array>

(async) getTimetableForWeek(date, id, type, formatIdopt, validateSessionopt) → {Promise.<Array.<WebAPITimetable>>}

Get the timetable for the current week for a specific element from the web client API.

Source:
Parameters:
Name Type Attributes Default Description
date Date

one date in the week to query

id number

element id

type WebUntisElementType

element type

formatId Number <optional>
1

set to 1 to include teachers, 2 omits the teachers in elements response

validateSession Boolean <optional>
true
Returns:
Type:
Promise.<Array.<WebAPITimetable>>

(async) login() → {Promise.<Object>}

Login with your credentials

Notice: The server may revoke this session after less than 10min of idle.

Untis says in the official docs:

An application should always logout as soon as possible to free system resources on the server.

Source:
Returns:
Type:
Promise.<Object>

(async) logout() → {Promise.<boolean>}

Logout the current session

Source:
Returns:
Type:
Promise.<boolean>

(async) validateSession() → {Promise.<boolean>}

Checks if your current WebUntis Session is valid

Source:
Returns:
Type:
Promise.<boolean>