Skip to content

GET Schedule

Developer From Jokela edited this page Aug 11, 2020 · 1 revision

Wilma Schedule can be accessed via:

  • BasePath for basic schedule: https://<your_wilma_server>/schedule/index_json with optional GET parameters ?date=01.01.2020
  • BasePath for advanced schedule: https://<your_wilma_server>/schedule/index_json with required GET parameters ?p=01.01.2020 (start of schedule range) &f=09.01.2020(end of schedule range)

Basic schedule

GET request to BasePath for basic schedule will get you this response:

{
   "Schedule":[
      {
         "ReservationID":11053,
         "ScheduleID":146221344,
         "Day":1,
         "Start":"08:15",
         "End":"09:30",
         "Color":"#A6CAF0",
         "X1":0,
         "Y1":0,
         "X2":10000,
         "Y2":74,
         "Class":"7a\/e",
         "AllowEdit":false,
         "AllowAddMoveRemove":false,
         "Groups":[
            {
               "ShortCaption":"KO01.2",
               "Caption":"KO01.2",
               "FullCaption":"Kotitalous yhteinen",
               "Class":"7a\/e",
               "Teachers":[
                  {
                     "Id":1393,
                     "Caption":"DFJ",
                     "LongCaption":"Developer From jokela",
                     "ScheduleVisible":true
                  }
               ],
               "Rooms":[
                  {
                     "Id":318,
                     "Caption":"KO1",
                     "LongCaption":"Kotitalous1",
                     "ScheduleVisible":true
                  }
               ]
            }
         ]
      },
      {
         "ReservationID":10322,
         "ScheduleID":146221344,
         "Day":1,
         "Start":"09:45",
         "End":"11:00",
         "Color":"#A6CAF0",
         "X1":0,
         "Y1":89,
         "X2":10000,
         "Y2":164,
         "Class":"7a\/e",
         "AllowEdit":false,
         "AllowAddMoveRemove":false,
         "Groups":[
            {
               "ShortCaption":"KO01.2",
               "Caption":"KO01.2",
               "FullCaption":"Kotitalous yhteinen",
               "Class":"7a\/e",
               "Teachers":[
                   {
                     "Id":1393,
                     "Caption":"DFJ",
                     "LongCaption":"Developer From jokela",
                     "ScheduleVisible":true
                  }
               ],
               "Rooms":[
                  {
                     "Id":318,
                     "Caption":"KO1",
                     "LongCaption":"Kotitalous1",
                     "ScheduleVisible":true
                  }
               ]
            }
         ]
      }
   ],
   "Terms":[
      {
         "Name":"1. jakso",
         "StartDate":"2018-08-09",
         "EndDate":"2018-09-28"
      },
      {
         "Name":"2. jakso",
         "StartDate":"2018-10-01",
         "EndDate":"2018-11-27"
      },
      {
         "Name":"3. jakso",
         "StartDate":"2018-11-28",
         "EndDate":"2019-02-04"
      },
      {
         "Name":"4. jakso",
         "StartDate":"2019-02-05",
         "EndDate":"2019-04-04"
      },
      {
         "Name":"5. jakso",
         "StartDate":"2019-04-05",
         "EndDate":"2019-06-01"
      }
   ]
}

Let's do a deep dive how this schedule works (it's complex without reading this):

Firstly, we have this Schedule array which contains our schedule. Then we have another array called Terms.

Terms seem to be easy, so let's focus on schedule.

Here's how one lesson looks like:

 {
         "ReservationID":11053,
         "ScheduleID":146221344,
         "Day":1,
         "Start":"08:15",
         "End":"09:30",
         "Color":"#A6CAF0",
         "X1":0,
         "Y1":0,
         "X2":10000,
         "Y2":74,
         "Class":"7a\/e",
         "AllowEdit":false,
         "AllowAddMoveRemove":false,
         "Groups":[
            {
               "ShortCaption":"KO01.2",
               "Caption":"KO01.2",
               "FullCaption":"Kotitalous yhteinen",
               "Class":"7a\/e",
               "Teachers":[
                  {
                     "Id":1393,
                     "Caption":"DFJ",
                     "LongCaption":"Developer From jokela",
                     "ScheduleVisible":true
                  }
               ],
               "Rooms":[
                  {
                     "Id":318,
                     "Caption":"KO1",
                     "LongCaption":"Kotitalous1",
                     "ScheduleVisible":true
                  }
               ]
            }
         ]
      }

Let me explain what each key means:

  • ReservationID: Wilma stores this lesson in their system with that ID
  • ScheduleID: Basically for every student/person Wilma has its schedule, this is the ID for schedule
  • Day: Of course, Visma is too lazy to put a timestamp. They placed an integer which represents days. So i.e. 1 = Monday, 2 = Tuesday, etc.
  • Start When the lesson starts
  • End When the lesson ends
  • X1, Y1, X2, Y2 are coordinates for something
  • Class: Which class is attending this lesson
  • AllowEdit: This should tell if user has a permission to edit the schedule
  • AllowAddMoveRemove: Not sure what this is, but I know for sure that it's related to previous one
  • Groups: List of courses that this lesson is associated with

Here's one group:

{
   "ShortCaption":"KO01.2",
   "Caption":"KO01.2",
   "FullCaption":"Kotitalous yhteinen",
   "Class":"7a\/e",
   "Teachers":[
      {
         "Id":1393,
         "Caption":"DFJ",
         "LongCaption":"Developer From jokela",
         "ScheduleVisible":true
      }
   ],
   "Rooms":[
      {
         "Id":318,
         "Caption":"KO1",
         "LongCaption":"Kotitalous1",
         "ScheduleVisible":true
      }
   ]
}

Let me explain what each key means for the Group:

  • ShortCaption: "Short caption, like few letters and one number"
  • Caption: Longer than ShortCaption
  • FullCaption: Most detailed and lengthy name of that course
  • Class: Which class is attending this course
  • Teachers: Teachers list
  • Rooms: List of rooms where this course should be attended

Here's one teacher (same desin applies to rooms):

{
   "Id":1393,
   "Caption":"DFJ",
   "LongCaption":"Developer From jokela",
   "ScheduleVisible":true
}
  • Id: Id of that room or user
  • Caption: Shorter version of LongCaption
  • LongCaption: Most detailed and lengthy name of that user or room
  • ScheduleVisible: If true, this means that this user's or room's schedule can be accessible via advanced schedule request

You can also fetch teachers, personnels, or students schedule with this URL: https://<your_wilma_server>/schedule/index_json/export/<type>/<id>/index_json with optional GET parameters ?date=01.01.2020

  • type: Should be one of these: teachers, personnels or students
  • id: ID of resource, i.e.

NOTE: Fetching teachers, personnels or students don't always work, prefer to use advanced schedule for this task instead

Advanced Schedule

GET request to BasePath for advanced schedule These are all available GET parameters:

  • teachers (IDs of teachers separated by ,, or type all to fetch all teachers)
  • personnel (IDs of personnel separated by ,, or type all to fetch all personnel)
  • students (IDs of students separated by ,, or type all to fetch all students)
  • rooms (IDs of rooms separated by ,, or type all to fetch all rooms)

NOTE: This API request can be limited (depending on Wilma server settings and account type) to only account's own schedule, meaning that rooms, students, personnel or teachers parameters will not be accessible

Response:

{
   "RecourceSchedules":[
      {
         "PrimusType":"student",
         "PrimusID":5678,
         "PrimusName":"developerfromjokela",
         "Schedule":[
            {
               "UID":"Example School 2020-2021\/23750",
               "Day":1,
               "Start":"09:45",
               "End":"11:00",
               "Type":"teaching",
               "Color":"#A6CAF0",
               "Class":"9E",
               "Dates":[
                  "17.08.2020",
                  "24.08.2020"
               ],
               "Groups":[
                  {
                     "KurreId":23750,
                     "Id":154208,
                     "CourseId":14588,
                     "ShortCaption":"TVT1.1",
                     "Caption":"TVT1.1",
                     "FullCaption":"Tieto- ja viesintätekniikka",
                     "CourseType":[
                        {
                           "Id":"",
                           "Name":"ya yhteinen aine",
                           "AccountCode":"Lähiopetus"
                        }
                     ],
                     "Teachers":[
                        {
                           "PrimusId":234,
                           "Caption":"DFJ",
                           "LongCaption":"Developer From Jokela"
                        }
                     ],
                     "StudentsPresent":20,
                     "StudentsTotal":20
                  }
               ]
            }
         ]
      }
   ]
}

Clone this wiki locally