Introduction
This article describes how you can use Learn365 APIs to change the progress status of a learning module from Not started or In progress to Completed.
Prerequisites
1. Go to https://api.365.systems/ and authorize with the relevant API key. For more information about the authorization process, see this article.
2. For a request to change the completion status of a learning module, you need to get the relevant user's enrollment ID, the ID of the learning module in question, and the IDs of its learning items.
To get this data:
- Find the Courses section, expand it, find the GET method /odata/v2/Courses with the Returns the list of Courses description, and select Try it out.
- In the $expand field, enter Enrollments, LearningModules to allow the response to include data about users' enrollments and learning modules inside courses.
You can narrow the response further using the $filter field, if you have the ID or title of the course that contains the learning module. In this case, in the $filter field, you can enter Title eq 'course title' or Title eq 'course ID', where course title and course ID are replaced with the relevant data.
- Select Execute to run the request.
3. Go to the Responses block to see the results.
- Number 2xx (for example, 200) under Code shows that the request worked correctly. You can Download the data from the response to your computer in .JSON format.
- In the Response body field, you can see all the courses of the tenant that contain learning modules (including their IDs) and data related to users who are enrolled in the courses (including their enrollment ID). Search for the relevant learning module or user using Ctrl+F.
4. Get the ID of the relevant learning module next to the Id parameter, under LearningModules.
5. Get the user's enrollment ID next to the Id parameter, under Enrollments.
6. Once you have the ID of the learning module, you can get the IDs of the learning items inside the learning module. To do this, follow these steps:
- Find the LearningModules section, expand it, find the GET method /odata/v2/LearningModules{Id} with the Returns the Learning Module by Id description, and select Try it out.
- In the key: Id field, enter the ID of the learning module in question.
- In the $expand field, enter Configuration to allow the response to include the learning items of the learning module.
7. When ready, select Execute to run the request.
8. Go to the Responses block to check the results.
- Number 2xx (for example, 200) under Code shows that the request worked correctly.You can Download the data from the response to your computer in .JSON format.
- In the Response body field, you can see all the learning items in the learning module, including their IDs.
Complete a learning module via API
When the required data is collected, you can run a request to set the status of the relevant learning module as completed for the user in question.
1. Find the LearningModuleAttempts section, expand it, find the POST /odata/v2/LearningModuleAttempts with the Creates Learning Module Attempt description, and select Try it out.
2. Complete the fields, paying attention to the required parameters:
- Id, an optional parameter. Replace guid with the ID of the attempt.
- LearningModuleId, a required parameter. Replace guid with the ID of the learning module.
- EnrollmentId, a required parameter. Replace guid with the user's enrollment ID.
- PercentOfCompleting, an optional parameter. Replace integer with a whole number. If not set, the system automatically calculates this value based on the data provided for the required parameters.
- IsCompleted, an optional parameter in this case. Replace boolean with true to set the learning module as completed. If not set, the system automatically calculates this value based on the data provided for the required parameters.
- IsCompletedCorrectly, an optional parameter in this case. Replace boolean with true to set the learning module as successfully completed. If not set, the system automatically calculates this value based on the data provided for the required parameters.
- PassingTimeTicks, an optional parameter. Replace integer with a whole number.
- Status, an optional parameter. Replace integer with the relevant number to set the progress status of the learning module: 0 (not started), 1 (in progress), 2 (failed) or 3 (completed). If not set, the system automatically calculates this value based on the data provided for the required parameters.
-
State, a required parameter that corresponds to the status of the user's attempt on the items of the learning module.
Replace string with {\"item ID\":item status}, where for item ID and item status, the corresponding data is entered.
The ID of the attempts was obtained in the Prerequisites section.
The status of the attempt can be one of the following: 0 (item isn't started), 1 (item is passed, therefore completed), and 2 (a failed item).
If there are several learning items in the learning module, then the value will look like this: "State": "{\"item ID\":item status, \"item ID\":item status, \"item ID\":item status}", where \"item ID\":item status is entered for each item of the learning module.
EXAMPLE
{
"LearningModuleId": "d2ac2f0b-da68-4355-92ae-f1f3c0462430",
"EnrollmentId": "0c15072c-d075-459d-b9ce-9999b6e7d6ea",
"State": "{\"f492afbe-26af-489f-92e5-d3e3550f1824\":1, \"13eb2f60-ee89-4130-a38b-ce59eee9aeeb\":1, \"d5be02b1-e574-4c62-8d08-0fea4646cdaa\":2, \"5e3eec35-7e76-4fb0-a55b-63830b0e0351\":1, \"b98d7bb0-8a2f-459f-830f-03b5d254de2a\":1}"
}
3. When ready, select Execute to run the request.
4. Go to the Responses block to check the results.
- Number 2xx (for example, 201) under Code shows that the request worked correctly. You can Download the data from the response to your computer in .JSON format.
- In the Response body field, you'll see data about learning module completion. You can check the completion of the learning module for the user in the Learn365 Admin Center. Find more information about how to track user's progress on the learning module and its items, see this article.
Comments
Article is closed for comments.