Get user progress from Course

If you want to find out which users have completed a specific course, you can query the learners enrolled in a course with the respective course completion status. To do this, you first need the content_id of the course.

Get all courses from tenant

Assuming that the content_id is not yet known, we demonstrate how it is possible to query it through the API. First, you can retrieve all courses of a tenant to map the content_id of the various courses.

GET api.int-tutool.io/lms/tenant/contents

Response:

{
"content": [
{
"id": 290, <-----
"rootAsset": {
"dtype": "Course",
"id": 186,
"title": "Test - E-Learnings - No. 2", <----
"description": "Lorem ipsum dolor sit amet",
...,
},
"tags": [],
"groups": [],
"assetOwner": {
...,
},
"distribution": {
...,
},
"assignmentHistory": [
...,
],
"subAssignments": []
},
...
}
],
"page": {
"size": 2000,
"totalElements": 241,
"totalPages": 1,
"number": 0
}
}

info

Please note the information on pagination

The response object should look something like this. The highlighted values are important. We have the Content Id, which we will continue working with, and the course-specific information such as title, etc., in the rootAsset. It’s crucial to know where the attributes are located to apply the filters correctly. Therefore, in the next step, we will demonstrate how to filter a course based on its title.

In the Swagger API documentation, there should be a description for each endpoint that supports filtering options, explaining how to apply them.

Filter courses by title

To search for a course with a specific title, our filters can be applied. These filters allow us to search for most attributes found in the objects. While complex filtering rules are possible, we will focus on title filtering.

As shown below, the filter would be passed as a query parameter to search for a specific title

{
"dtype":"FilterComposition",
"condition":"AND",
"filters":
[
{
"dtype":"FilterLike",
"key":"rootAsset.title",
"value":"<title-search>"
}
]
}
curl --location 'https://api.int-tutool.io/lms/tenant/contents?filterParameter=%7B%22dtype%22%3A%22FilterComposition%22%2C%22condition%22%3A%22AND%22%2C%22filters%22%3A%5B%7B%22dtype%22%3A%22FilterLike%22%2C%22key%22%3A%22rootAsset.title%22%2C%22value%22%3A%22test%22%7D%5D%7D' \
--header 'x-tenant-id: <insert-tenant-id>' \
--header 'x-instance-id: <insert-instance-id>' \
--header 'Authorization: Bearer eyJh...'

Get information of all user in a course

With the obtained content_id, you can now query the status of all users associated with this course at the following endpoint.
GET api.int-tutool.io/lms/tenant/distribution/contents

[x]

This query object needs to be URL-encoded before appending it as a query parameter to your request.

Query Parameter: filterParameter

{
"dtype":"FilterEquals",
"key":"parentContent.id",
"value":<content_id>
}
curl --location 'https://api.int-tutool.io/lms/tenant/distributions/contents?filterParameter=%7B%22dtype%22%3A%22FilterEquals%22%2C%22key%22%3A%22parentContent.id%22%2C%22value%22%3A290%7D' \
--header 'x-tenant-id: <insert-tenant-id>' \
--header 'x-instance-id: <insert-instance-id>' \
--header 'Authorization: Bearer eyJh...' \
--data ''

With this request, we obtain all users for a course along with their progress information

Here, it is explained how to interpret the response.

Get information of a specific user in a course

However, you can also filter only the progress information of a user. For this purpose, the filter is constructed as follows, as described above. You will need the content_id and the user_email as mentioned earlier.

This query object needs to be URL-encoded before appending it as a query parameter to your request.

Query Parameter: filterParameter

{
"dtype":"FilterComposition",
"condition":"AND",
"filters":
[
{
"dtype":"FilterComposition",
"condition":"OR",
"filters":
[
{
"dtype":"FilterLike",
"key":"owner<User>.email",
"value":"<insert-email>" <-------- insert userEmail
}
]
},
{
"dtype":"FilterEquals",
"key":"parentContent.id",
"value": <insert-content-id> <----- insert contenID
}
]
}
curl --location 'https://api.int-tutool.io/lms/tenant/distributions/contents?filterParameter=%7B%22dtype%22%3A%22FilterComposition%22%2C%22condition%22%3A%22AND%22%2C%22filters%22%3A%5B%7B%22dtype%22%3A%22FilterLike%22%2C%22key%22%3A%22owner%3CUser%3E.email%22%2C%22value%22%3A%22srafnixschaf%40gmx.de%22%7D%2C%7B%22dtype%22%3A%22FilterEquals%22%2C%22key%22%3A%22parentContent.id%22%2C%22value%22%3A290%7D%5D%7D' \
--header 'x-tenant-id: <insert-tenant-id>' \
--header 'x-instance-id: <insert-instance-id>' \
--header 'Authorization: Bearer eyJh...' \

You can also use the user_id for the filterParameter

{
"dtype":"FilterComposition",
"condition":"AND",
"filters":
[
{
"dtype":"FilterEquals",
"key":"owner<User>.userId",
"value":"<insert-user-id>" <----- userId
},
{
"dtype":"FilterEquals",
"key":"owner<User>.state",
"value":"ACTIVE"
}
]
}

Here, it is explained how to interpret the response.