Enroll users
Enroll users in one course as an admin.
POST https://cotlet.dev/api/v1/absorb-lms/courses/{course_id}/users/enroll
Enrolls the listed users in one course through the Enroll User action of the Users report, so the Enrollment Method is Admin and the course approval step does not apply. Absorb often sends its enrollment message to the learner. A user who already completed the course needs re_enroll true, as Absorb asks for Re-Enroll in that case. Absorb processes large batches at 10 minute intervals, so check with list_course_enrollments a little later. By default you confirm each call; you can switch that off for this tool.
Parameters
| Name | Type | Description |
|---|---|---|
| course_id string required | string | Course ID from list_courses. |
| user_ids array required | array | user_id values from list_users. |
| re_enroll boolean | boolean | true creates a new assignment for users who completed the course. Default: false. |
Request
curl -X POST https://cotlet.dev/api/v1/absorb-lms/courses/c2d6a1f4-5b8e-4a37-9d02-7f1e3c5b8a10/users/enroll \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_ids":["4f1c2a7e-8b3d-4c1a-9e55-0a6d3b7c1201","9b7e5d10-2c44-4f0b-8a31-6e2f9c4d7702"]}' result = client.call("absorb-lms", "enroll_users", {"course_id":"c2d6a1f4-5b8e-4a37-9d02-7f1e3c5b8a10","user_ids":["4f1c2a7e-8b3d-4c1a-9e55-0a6d3b7c1201","9b7e5d10-2c44-4f0b-8a31-6e2f9c4d7702"]}) const result = await cotlet.call('absorb-lms', 'enroll_users', {"course_id":"c2d6a1f4-5b8e-4a37-9d02-7f1e3c5b8a10","user_ids":["4f1c2a7e-8b3d-4c1a-9e55-0a6d3b7c1201","9b7e5d10-2c44-4f0b-8a31-6e2f9c4d7702"]}); cotlet call absorb-lms enroll_users --data '{"course_id":"c2d6a1f4-5b8e-4a37-9d02-7f1e3c5b8a10","user_ids":["4f1c2a7e-8b3d-4c1a-9e55-0a6d3b7c1201","9b7e5d10-2c44-4f0b-8a31-6e2f9c4d7702"]}' Example response
{
"course": "Warehouse Safety Basics",
"enrolled": [
{
"user_id": "4f1c2a7e-8b3d-4c1a-9e55-0a6d3b7c1201",
"name": "Dana Reyes"
},
{
"user_id": "9b7e5d10-2c44-4f0b-8a31-6e2f9c4d7702",
"name": "Omar Haddad"
}
],
"skipped": []
}