I was working on a Make.com workflow to mass delete a particular learning object from all of our courses and ran into a problem with not being able to find an appropriate API endpoint. Our learning objects are not in the CLOR, and if you try to simulate an admin user (in the UI) making an HTTP GET with an automation solution like Make.com, you run into a problem with that call returning some YES/NO buttons you can’t click (the URL in question is https://www.YOURPLATFORM.com/lms/index.php?r=player/training/axDeleteLo ).
So, not wanting to be defeated by a simple button I can’t push without an RPA tool, I found a workaround to share with the community. It overcomes the lack of an API endpoint for deleting LOs by using the CLOR as an intermediate landing spot, and then cleaning up afterward.
- Create your automation workflow to gather all the LOs you want to get rid of. You’re going to need the IdOrg and course_id for each one. For us that means looping through all the courses with https://www.YOURPLATFORM.com/learn/v1/courses?page=X&page_size=200 and the LO’s with https://www.YOURPLATFORM.com/learn/v1/courses/COURSEID/los?page_size=200 , iterating through each one and filtering for the ones you want to process further.
- Downstream from that you’re going to make three HTTP OAuth authenticated calls that will move each LO to the CLOR, delete the LO from the course, and then from the CLOR:
- STEP 1: The first call is a POST to https://www.YOURPLATFORM.com/tmrepo/v1/courses/materials/batch
with the JSON payload of:{
"items":<
{
"course_id":###,
"material_id":###, <--- This will be the id_org (the LO number) you previously obtained
"folder_id":1
}
]
}
My example has just one item for simplicity. The return from the above call should look like this:{
"data": t
{
"row_index": 0,
"success": true,
"message": "",
"output": {
"id": ### ← Save this special CLOR ID number to a variable for step 3.
}
}
],
"version": "1.0.0",
"_links": <]
}
Save the id that is returned. It is the item’s CLOR id. You’ll need it in the third step below. -
STEP 2: The second call is a DELETE to https://www.YOURPLATFORM.com/learn/v1/courses/###/lo/###
It will just return a “success”: true
The course number is the first ### and the IdOrg/LO number is the second ### in the example above. -
STEP 3: The third call is a DELETE to https://www.YOURPLATFORM.com/tmrepo/v1/materials/batch with a JSON payload of:
{
"items"::
{
"material_id": ### ← This is the CLOR ID you saved from step 1 as a variable
}
]
}
It will just return a “success”: true if everything worked properly.
- STEP 1: The first call is a POST to https://www.YOURPLATFORM.com/tmrepo/v1/courses/materials/batch