If you are interested in how often a publication is used in your school, you can use the API to extract these insights. This article provides the steps to take in order to extract how many assignments have had a publication set and whether students were allowed to start a discussion. To demonstrate that this information can also be retrieved for one of your school departments, we will only look at assignments being part of a specific department.
Step 1 – List all studies of a department
To list the studies of a department, a GET request must be made to:
GET /api/v2/departments/{department_id}/studies
By default every list request returns 20 records. It is possible to adjust the number of records per page with the usage of the "limit" parameter. You can specify any value between 1 and 100 (records per page). More information on pagination can be found in the What is the API article.
Step 2 – Loop over all courses
To find the courses that belong to a specific department, we check if each course belongs to a study in your department. To do so, we first need to perform a GET request to retrieve all courses from your school:
GET /api/v2/schools/{school_id}/courses
Since the list of courses does not contain the linked studies, we will need to perform another GET per course to retrieve the linked studies with the received course_id.
GET /api/v2/courses/{course_id}
The course object has an attribute called study_ids, which holds the IDs of the linked studies. We are interested in a course if it contains a study_id matching any ID of the studies we retrieved in Step 1.
Step 3 – Loop over all course assignments
Step 2 has provided us with a list of courses that are linked to studies. We want to loop over this list of courses and retrieve a list of assignments for each and every course. To do so, a a GET request must be made to:
GET /api/v2/courses/{course_id}/assignments
We will use the retrieved assignment IDs in Step 4 to check if the assignment has been published.
Step 4 – List publication timeslots
With the retrieved assignment IDs in Step 3, we can perform a GET request to:
GET /api/v2/assignments/{assignment_id}/publication_timeslots
If the request returns one or more records, a publication was created for students. You can check publish_start_datetime
and publish_end_datetime
attributes to see when the assignment was published. The allow_discussions
attribute indicates whether discussions were allowed for students. The discussion_start_datetime
and discussion_end_datetime
indicates the timeframe of when discussions were allowed.
Comments
0 comments
Please sign in to leave a comment.