Skip to content

Requests and Responses

Marc Rousavy edited this page May 29, 2017 · 14 revisions

WebUntisSharp Documentation

Welcome to the WebUntisSharp wiki.

This page will cover all calls you can make to the WebUntis server, and all responses you will get.

Take a look at all Requests and Responses, or at the official JSON PDF.

Requests & Responses

Create Session

To use these Requests you have to have a session already created. See the home page for info on creating a new session.

Login

Create a new session and login with given credentials.

You will not need to login manually, the Constructors will take care of this.

await untis.Login(
    string user, // Username for the WebUntis account
    string password, // Password for the WebUntis account
    string client // The Client (e.g. "ANDROID")
);

Logout

Logout/End the current Session.

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

You do not have to manually logout, when using a using-block or calling the Dispose() method.

await untis.Logout();

GetTeachers

Get a List of all Teachers

List<Teacher> teachers = await untis.GetTeachers();

The Teacher class:

int id;
string name;
string foreName;
string longName;
string foreColor;
string backColor;

GetStudents

Get a List of all Students

List<Student> students = await untis.GetStudents();

The Student class:

int id;
string key;
string name;
string foreName;
string longName;
string gender;

GetClasses

Get list of base classes for schoolyear

List<Class> classes = await untis.GetClasses(
    string schoolyearId // The ID of the school year to query Classes
);

The Class class:

int id;
string name;
string longName;
string foreColor;
string backColor;
int did;

GetSubjects

Get a List of all Subjects

List<Subject> subjects = await untis.GetSubjects();

The Subject class:

int id;
string name;
string longName;
string foreColor;
string backColor;

GetRooms

Get a List of all Rooms

List<Room> rooms = await untis.GetRooms();

The Subject class:

int id;
string name;
string longName;
string foreColor;
string backColor;

GetDepartments

Get a List of all Departments

List<Department> departments = await untis.GetDepartments();

The Department class:

int id;
string name;
string longName;

GetHolidays

Get a List of all Holidays

List<Holiday> holidays = await untis.GetHolidays();

The Holiday class:

int id;
string name;
string longName;
long startDate;
long endDate;

GetTimegrid

Get the current Timegrid

Timegrid timegrid = await untis.GetTimegrid();

The Timegrid class:

int day; // day of the week, 1 = sunday, 2 = monday, .. 7 = saturday
TimeUnit[] timeUnits;

The TimeUnit class:

long startTime;
long endTime;

GetStatusData

Information about lesson types and period codes and their colors

StatusData statusData = await untis.GetStatusData();

The StatusData class:

KeyValuePair<string, Colors> lstypes;
KeyValuePair<string, Colors> codes;

The Colors class:

string foreColor;
string backColor;

GetSchoolyear

Get data for the current schoolyear

Schoolyear schoolyear = await untis.GetSchoolyear();

The Schoolyear class:

int id;
string name;
long startDate;
long endDate;

GetSchoolyears

Get a list of all available schoolyears

List<Schoolyear> schoolyears = await untis.GetSchoolyears();

The Schoolyear class:

int id;
string name;
long startDate;
long endDate;

GetTimetableForElement

Get a Timetable for a given Element

TimetableResult timetable = await untis.GetTimetableForElement(
    int elementId, // The ID of the Element (e.g. with elementType 2 (=teacher), the teacher's ID)
    int elementType, // The type of the Element (1 = class, 2 = teacher, 3 = subject, 4 = room, 5 = student)
    long startDate, // The Start Date of the Timetable (default: current)
    long endDate // The End Date of the Timetable (default: current)
);

The TimetableResult class:

int id; // ID of period
long date;
long startTime;
long endTime;
int[] kl; // array of classes ids
int[] te; // array of teacher ids
int[] su; // array of subject ids
int[] ro; // array of room ids
string lstype; // „ls“ (lesson) | „oh“ (office hour) | „sb“ (standby) | „bs“ (break supervision) | „ex“ (examination) (omitted only if lesson)
string code; // „“ | „cancelled“ | „irregular“ omitted if empty
string lstext; // text of the lesson, omitted if empty
string statflags; // statistical flags of the lesson, omitted if empty

GetLastImportTime

Import time of the last lesson/timetable or substitution import from Untis

System.DateTime importTime = await untis.GetLastImportTime();

GetPersonId

Get Id of the person (teacher or student) by name

int personId = await untis.GetPersonId(
    int personType, // The Type of Person | 2 = Teacher, 5 = Student
    string surname, // The Surname of the Person to query
    string forename, // The Forename of the Person to query
    int birthdata // The Birthdata of the Person (Default is 0)
);

GetSubstitution

Request substitutions for the given date range

Substitution[] substitutions = await untis.GetSubstitution(
    long startDate, // The Begin Date of the Substitutions to filter
    long endDate, // The End Date of the Substitutions to filter
    int departmentId = 0 // The ID of the Department (default = 0)
);

The Substitution class:

//type of substitution:
//cancel = cancellation | subst = teacher substitution | add = additional period | shift = shifted period | rmchg = room change
string type;
ID id;
long date;
long startTime;
long endTime;
int[] kl;
int[] te;
int[] su;
int[] ro;
int[] txt;
Reschedule reschedule;

The ID class:

int id;
int orgid;

The Reschedule class:

int date;
int startTime;
int endTime;

GetClassRegEvents

Request classregevents for the given date range

Event[] events = await untis.GetClassRegEvents(
    long startDate, // The Begin Date of the ClassregEvents to filter
    long endDate // The End Date of the ClassregEvents to filter
);

The Event class:

string studentid;
string surname;
string forname;
long date;
string subject;
string reason;
string text;

GetExams

Get Exams

Exam[] exams = await untis.GetExams(
    long startDate, // The Begin Date of the ClassregEvents to filter
    long endDate, // The End Date of the ClassregEvents to filter
    int examTypeId // The Exam Type ID
);

The Exam class:

int[] classes;
int[] teachers;
int[] students;
int subject;
long date;
long startTime;
long endTime;
string name;
string longName;
bool showInTimetable;

GetExamTypes

Get Exams Types

Exam[] exams = await untis.GetExamTypes();

The Exam class:

int[] classes;
int[] teachers;
int[] students;
int subject;
long date;
long startTime;
long endTime;
string name;
string longName;
bool showInTimetable;