Add or remove courses from a training plan via API

In this article, we describe how to add or remove courses from a training plan via the Learn365 API.

 

See a list of current courses

Firstly, it’s worth checking what courses your training plan currently has. To do that, you’ll need the training plan ID. You can get this via the API by following the steps in this article.

To get a list of courses in your training plan:

1. Go to https://api.365.systems/ and make sure you are authorized with the relevant API key.

2. In the TrainingPlans section, select the GET /odata/v2/TrainingPlans({id})/Courses endpoint and select Try it out in the top right-hand corner.

3. In the id field, enter the training plan ID.

4. Use query option parameters to control the data in the response.

5. Select Execute to run the request.

6. Go to the Response block to check the results:

  • 200 code with a list of courses indicates a successful response. You can get more information about each course via API by using the course ID from the response and sending the GET /odata/v2/Courses({Id}) request.
  • 200 code with an empty list indicates there are no courses in the training plan.
  • In case of errors, the response body contains the error object with the code and message keys explaining the issue.

 

Add a course to a training plan

To add a course to a training plan, you’ll need:

  • The training plan ID. You can get this via the API by following the steps in this article.
  • The course ID. You can get this via the API by following the steps in this article.

To add a course to a training plan via API:

1. Go to https://api.365.systems/ and make sure you are authorized with the relevant API key.

2. In the TrainingPlans section, select the POST /odata/v2/TrainingPlans({id})/Courses({courseId}) endpoint and select Try it out in the top right-hand corner.

3. In the id field, enter the training plan ID.

4. In the courseId field, enter the course ID.

5. In the request body, you can enter the following optional parameters:

  • HasPrerequisite: If this parameter is set to True, a learner can start this course only after finishing the previous course in the training plan. If it's set to False, a learner can start the course without finishing the previous one.
  • Order: The order in which the course is presented in the training plan. It’s a number (integer) where 0 is the first course in a training plan. If no order is specified, the course will be presented last in the training plan.

    NOTE  

    If you add a course and leave the original course order, the existing courses are shifted accordingly to maintain the sequence.

    Let’s say you have a training plan with two courses:

    • The Onboarding course (Order: 0).
    • The Communication course (Order: 1).
    Let’s say you want to add the Set Up Your Laptop course as the first one of your training plan. You  would add this course with 0 as the Order. In this case, after adding a new course, the already existing courses automatically shift one step. As a result, your training plan will contain these courses in the following order:
    • The Set Up Your Laptop course (Order: 0).
    • The Onboarding course (Order: 1).
    • The Communication course (Order: 2).

 

So, the request path and body may look like this:

 

POST /odata/v2/TrainingPlans(9c6f3579-1295-4bec-b19a-2d8a8dddd292)/
Courses(ae733701-734c-40d8-b062-93d75381f509)

{
"Order": 0,
"HasPrerequisite": false
}

 

AddCourseToPlanRequest.png

 

6. Select Execute to run the request.

7. Go to the Response block to check the results:

  • 200 code with the course details indicates a successful response.
  • In case of errors, the response body contains the error object with the code and message keys explaining the issue.

 

Remove a course from a training plan

To remove a course from a training plan, you’ll need:

  • The training plan ID. You can get this via the API by following the steps in this article.
  • The course ID. You can get this via the API by following the steps in this article.

To remove a course from a training plan via the API:

1. Go to https://api.365.systems/ and make sure you are authorized with the relevant API key.

2. In the TrainingPlans section, select the DELETE /odata/v2/TrainingPlans({id})/Courses({courseId}) endpoint and select Try it out in the top right-hand corner.

3. In the id field, enter the training plan ID.

4. In the courseId field, enter the course ID.

5. Select Execute to run the request.

6. Go to the Response block to check the results:

  • 204 code with an empty body indicates a successful response.
  • In case of errors, the response body contains the error object with the code and message keys explaining the issue.

 

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

Comments

Article is closed for comments.