Course Enrollment

There are four ways to make a course available to a student:

  1. Set the course’s “Requires Enrollment” property to false. (Of course, this makes the course available to all users of the LMS, so make sure this is what you want!)

  2. Being added directly as an enrolled user.

  3. Being added to a group that is an enrolled group.

  4. Being added to a group that is a subgroup of an enrolled group, and having the “include subgroups” option selected for the course.

Enrolling a User Directly

To enroll a user, you’ll want to fetch the course, and then update the “enrolled_users” property array with your new user and PATCH it back into the course. Users should be added to the array by their system ID, not their username:

curl -X GET -H "App-Token: guddiclealCoph" -H "Token: 4599b52e75b4482ca11969ec2aada5f9" \
    -H "Content-Type: application/json" \
    "https://<yournamehere>.enfixlp.com/api/v1/courses/5144e53dbd7a840234574ee4"

Return looks something like:

{
    "_id": "5144e53dbd7a840234574ee4",
    "active": true,
    "date_added": "2013-03-17 23:52:40",
    "date_updated": "2013-03-16 17:43:20",
    "description": "",
    "enrolled_groups": [
        "51413a49bd7a841b9ca9528b",
        "514240aabd7a8474c26de51a"
    ],
    "enrolled_users": [],
    "title": "Course 3"
}

Then you would PATCH the user list with the new user ID:

curl -X PATCH -H "App-Token: guddiclealCoph" -H "Token: 4599b52e75b4482ca11969ec2aada5f9" \
    -H "Content-Type: application/json" -d '{"enrolled_groups": ["52d684c8bd7a8442e3365556"]}' \
    "https://<yournamehere>.enfixlp.com/api/v1/courses/5144e53dbd7a840234574ee4"

Enrolling a User Via a Group

To enroll a user via a group, you’ll want to fetch the group and add the user to the “members” of the group. From there, you’ll want to fetch the course object as above and update the “enrolled_groups” property:

curl -X PATCH -H "App-Token: guddiclealCoph" -H "Token: 4599b52e75b4482ca11969ec2aada5f9" \
    -H "Content-Type: application/json" \
    -d '{"enrolled_groups": ["52d684c8bd7a8442e3365556"]}' \
    "https://<yournamehere>.enfixlp.com/api/v1/courses/5144e53dbd7a840234574ee4"

Enrolling a User Via a Sub-Group

To enroll a user via a sub-group, you’ll want to follow all the steps above in Enrolling a User Via a Group. You’ll want to add one additional field into a PATCH: “include_subgroups”, with the parent group ID that contains all the groups you want enrolled (make sure this group is also in the “enrolled_groups”:

curl -X PATCH -H "App-Token: guddiclealCoph" -H "Token: 4599b52e75b4482ca11969ec2aada5f9" \
    -H "Content-Type: application/json" \
    -d '{"enrolled_groups": ["52d684c8bd7a8442e3365556"], "include_subgroups": ["52d684c8bd7a8442e3365556"]}' \
    "https://<yournamehere>.enfixlp.com/api/v1/courses/5144e53dbd7a840234574ee4"