Skip to content
Developer From Jokela edited this page Sep 16, 2022 · 4 revisions

Exams can be retrieved using two methods.

  • JSON (limited data)
  • HTML (full data)

JSON (limited data)

/overview POST-request provides some exam data, but it's heavily limited compared to offical API with API-key.

Using overview request, you get only limited amounts of data about current month's exam. Offical API returns all exams and upcoming ones too.

Body data:

  • date: Date of month in format dd.MM.yyyy
  • getfullmonth: true
  • format: json
  • formkey: Form Key of selected user

Response:

{
   "Role":"student",
   "AddAppt":false,
   "Schedule":[],
   "Exams":[],
   "Groups":[]
}

Exams are contained in Exams array.

Example Exam object:

{
   "Id":175362,
   "ExamId":102727,
   "Course":"OPNWLMA.1",
   "CourseId":16287,
   "Name":"OpenWilma Ohje",
   "CourseTitle":"OpenWilman käyttöohje ja muuta pulinaa",
   "Grade":"10+",
   "VerbalGrade": "Optional verbal grade!",
   "Teachers":[
      {
         "TeacherId":2170,
         "TeacherName":"Testausserveri",
         "TeacherCode":"TSRY"
      }
   ],
   "Date":"2.9.2022",
   "Info":"Tässä jotai infoa \r\nMuista oma läppäri mukaan!"
}

Parsing HTML requests (all data)

Endpoints

Upcoming exams URL: /exams/calendar

Past exams URL: /exams/calendar/past?printable

Past exams with custom starting and ending date: /exams/calendar/past?printable&range=-3&first=25.09.2019&last=25.09.2022

?printable cuts off any unnecessary parts of Wilma interface. This is used to save data and improve performance.


Parsing data for upcoming exams

Each exam is taking up its own table element with classes table table-grey.

Example CSS selector: "table.table.table-grey"

Example exam table content:

<tbody>
    <tr>
        <td class="col-lg-3 col-md-3">
            <strong>to 22.9.2022</strong>
            Klo 12:00
        </td>
        <td>
            Aihetta tähän : FY FY3 : Fysiikka 9k
        </td>
    </tr>

    <tr>
        <th class="col-lg-3 col-md-3">Opettaja</th>
        <td><a href="/!024291/profiles/teachers/213" class="ope profile-link">AHV (Anssi Ahvena Tuen testiope)</a>, <a href="/!024291/profiles/teachers/118" class="ope profile-link">HYP (Heikki Hypoteesi)</a></td>
    </tr>

    <tr>
        <th class="col-lg-3 col-md-3">Lisätietoja</th>
        <td>
            Jotai lisätietoi tähä<br />
            Multiline tuettuna<br />
            Yes
        </td>
    </tr>
</tbody>

First table row:

  • First table Row
    • First cell: date and time (optional)
    • Second cell: information about Course name, Course code and exam subject (optional)
  • Second table row
    • Second cell: Teachers (hyperlink with class ope, URL contains teacher ID appended at the end, and name is in the element)
  • Third table row (Optional)
    • Second cell: Extra information contained in td element

NOTICE! When parsing information about course name, code and exam subject, check string's split result (split with " : ") before finalizing data. Three separate strings should be present with subject, and only two without.

Parsing data for past exams

Exam table should be identified by its HTML element ID: examtable.

Table row content:

<tr>
    <td data-sortvalue="44006">ke 24.6.2020</td>
    <td><a href="/!024291/profiles/teachers/213" class="profile-link" title="Anssi Ahvena Tuen testiope">AHV</a>, <a href="/!024291/profiles/teachers/118" class="profile-link" title="Heikki Hypoteesi">HYP</a></td>
    <td class="col-lg-3 col-md-3">
        test : FY FY3 : Fysiikka 9k
    </td>
    <td></td>
    <td class="text-center" data-sortvalue="1000">
        10
    </td>
    <td>Hyvin tehty :-)</td>
</tr>
  • First cell: date
  • Second cell: Teachers (hyperlink with class profile-link, URL contains profile's ID appended at the end, and Code Name is in the element. Profile type is defined in url: /profiles/<type>/<id>. Full name is contained in attribute title)
  • Third cell: information about Course name, Course code and exam subject (optional)
  • Fourth: Extra information about exam (empty by default)
  • Fifth: Grade (empty if no grades assigned)
  • Sixth: Verbal grade (empty by default)

NOTICE! When parsing information about course name, code and exam subject, check string's split result (split with " : ") before finalizing data. Three separate strings should be present with subject, and only two without.