Change the publishing status of a learning item via API

Introduction

You can use Learn365 API endpoints to change the status of learning modules and quizzes from published to unpublished, or vice versa, therefore making the content available or unavailable to learners when they take a course. Alternatively, you can edit a learning item (a learning module or a quiz) directly from the Learn365 Admin Center by configuring its publishing settings.

This article describes how you can use Learn365 APIs to change the publishing status of learning modules and quizzes of a course.

 

NOTE   

Learning modules are unique to a specific course so changing the publishing status of a learning module affects only this course. Changing the publishing status of a quiz affects all the courses in the catalog that use the quiz.

 

Prerequisites 

To change the publishing status of learning modules and quizzes, you need to get the relevant learning item data, then run a request to update the data.

The update request requires you to enter some parameters, which can be obtained the following way:

1. Go to https:/api.365.systems/ and log in with the relevant API key. For more information about the authorization process, see this article.

2. In the list of Learn365 API sections, find the relevant section for the learning item for which you want to change the publishing status: LearningModules or Quizzes.

3. Find the relevant GET request, which you'll use to get the required parameters of the learning item in question:

  • For learning modules, find the GET method /odata/v2/LearningModules with the Returns the list of Learning Modules description.

  • For quizzes, find the GET method /odata/v2/Quizzes with the Returns the list of Quizzes description.

4. Expand the relevant GET request and select Try it out.

5. In the $expand field of the relevant GET method, enter the following value to include the relevant type of data in the response:

  • For learning modules, enter Configuration, Publishing. The response will include the publishing settings of the learning modules of the tenant and data about the items inside the learning modules.

  • For quizzes, enter Courses. The response will include a list of courses in which the quiz is used.

If you have the ID or title of a learning item, you can narrow the response to include data about the relevant item only. To do this, in the $filter field, enter Id eq item ID or Title eq 'item title', for example Id eq 90796418-a6e5-446c-96e5-00733621f771 or Title eq 'Phishing awareness guidelines', respectively.

6. Select Execute to run the request.

7. Go to the Response 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 data about the learning items across the whole tenant. Search for the relevant learning item using Ctrl+F.

Now we have the data required to update the relevant learning item.

 

Update the publishing status of a learning item

Learning module

NOTE   

The PUT method used to update the learning module details replaces all the learning module information, not just the details you provide. This means that all the parameters need to be specified, otherwise the parameters that aren't stated will be overwritten with no data.

 

1. Find the LearningModules section, expand it, find the PUT method /odata/v2/LearningModules({Id}) with the Updates Learning Module description, and select Try it out.

2. Complete the fields, paying close attention to the required parameters:

  • key:Id, a required parameter. Enter the ID of the learning module for which you want to update the publishing settings.

  • In the Edit Value field, enter the data of the learning module you obtained in the previous section. The following example shows only the expected format of the data. Remember to use your own data when entering the parameters. Pay close attention to the IsEnabled parameter because true makes the learning module published and false makes it unpublished. 


EXAMPLE

{
"Id": "90796418-a6e5-446c-96e5-00733621f771",
"CourseId": "7bb988b8-140a-4ee5-9141-5863868e719f",
"Title": "Phishing awareness guidelines, introduction",
"Description": "In this learning module you will be given an introduction to some of the most common phishing attack types.",
"IsPublished": true,
"Order": 4,
"HasPrerequisite": false,
"Configuration": {
"LearningModuleId": "90796418-a6e5-446c-96e5-00733621f771",
"Items": "[{\"ScormId\":\"0ff0c1db-886c-4ea7-b4d4-883ad86e9956\",\"ItemType\":2,\"PackageType\":0,\"Id\":\"0ff0c1db-886c-4ea7-b4d4-883ad86e9956\",\"Title\":\"Phishing awareness guidelines\",\"IsAvailable\":null,\"IsDeleted\":null}]"
},
"Publishing": {
"Id": "90796418-a6e5-446c-96e5-00733621f771",
"IsEnabled": false,
"StartDate": "2023-02-12T09:40:56Z",
"EndDate": null
}
}

 

update_lm_request

 

3. When ready, select Execute to run the request.

4. Go to the Responses block to check the results.

 

Quiz

NOTE   

  • The PUT method used to update the quiz details replaces all the quiz information, not just the details you provide. This means that all the parameters need to be specified, otherwise the parameters that aren't stated will be overwritten with no data.
  • Changing the publishing status of a quiz affects all the courses in the catalog that contain the quiz.

 

1. Find the Quizzes section, expand it, find the PUT method /odata/v2/Quizzes({Id}) with the Updates a Quiz description, and select Try it out.

2. Complete the fields, paying close attention to the required parameters:

  • key:Id, a required parameter. Enter the ID of the quiz for which you want to update the publishing settings.
  • In the Edit Value field, enter the data of the quiz obtained in the previous section. The following example shows only the expected format of the data. Remember to use your own data when entering the parameters. Pay close attention to the IsEnabled parameter because true makes the quiz published and false makes it unpublished. 

 

EXAMPLE

{
"Id": "7bd0e56d-c512-402d-bcf6-7895a5f8fc37",
"Title": "Test yourself",
"Description": null,
"MaxAttemptsLimit": null,
"PassingPercentage": 10,
"IsPublished": false,
"PublishingStartDate": "2021-11-04T13:47:00Z",
"PublishingEndDate": null,
"Randomize": false,
"ShowScore": true,
"ShowCompletionScore": true,
"ShowPoints": false,
"AllowReview": true,
"AllowNavigation": false,
"ShowCorrectAnswers": false,
"ReviewMode": "DoNotShowAnyAnswers",
"TimeLimit": null,
"ShowTimer": false,
"Questions": "[{\"RightAnswer\":false,\"QuestionType\":2,\"Id\":\"bd64d7ec-262f-4d94-a41c-8e49235e3129\",\"Title\":\"Information Security \",\"Description\":\"\\\"You should never copy any content to a learning module - instead, link to the\\nonline content.\\\" - Is that so?\",\"Points\":3,\"PositiveFeedback\":\"That's correct! If\\na learning item is not expected to be updated - as is often the case with\\ndocuments or presentations - you can safely add a copy of that item to the\\nlearning module.\",\"NegativeFeedback\":\"That's incorrect - please try again!\",\"SemiPositiveFeedback\":null,\"Tags\":[]}]",
"ModifiedAt": "2022-08-16T10:43:30.603Z",
"CreatedAt": "2021-11-04T13:48:36.327Z"
}

 

3. When ready, select Execute to run the request.

4. Go to the Responses block to check the results.

 

Was this article helpful?
1 out of 1 found this helpful

Comments

Article is closed for comments.