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" \
    "http://127.0.0.1:5000/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_users": ["52d684c8bd7a8442e3365556"]}' \
    "http://127.0.0.1:5000/api/v1/courses/5144e53dbd7a840234574ee4"

Enrolling a User Via a Group

TODO

Enrolling a User Via a Sub-Group

TODO