lms.djangoapps.bulk_enroll package#
Submodules#
lms.djangoapps.bulk_enroll.serializers module#
Serializers for Bulk Enrollment.
- class lms.djangoapps.bulk_enroll.serializers.BulkEnrollmentSerializer(*args, **kwargs)#
Bases:
SerializerSerializes enrollment information for a collection of students/emails.
This is mainly useful for implementing validation when performing bulk enrollment operations.
- validate(attrs)#
Check that the cohorts list is the same size as the courses list.
- validate_courses(value)#
Check that each course key in list is valid.
lms.djangoapps.bulk_enroll.urls module#
URLs for the Bulk Enrollment API
lms.djangoapps.bulk_enroll.views module#
API views for Bulk Enrollment
- class lms.djangoapps.bulk_enroll.views.BulkEnrollView(**kwargs)#
Bases:
APIViewUse Case
Enroll multiple users in one or more courses.
Example Request
- POST /api/bulk_enroll/v1/bulk_enroll/ {
“auto_enroll”: true, “email_students”: true, “action”: “enroll”, “courses”: “course-v1:edX+Demo+123,course-v1:edX+Demo2+456”, “cohorts”: “cohortA,cohortA”, “identifiers”: “brandon@example.com,yamilah@example.com”
}
POST Parameters
A POST request can include the following parameters.
auto_enroll: When set to true, students will be enrolled as soon as they register.
email_students: When set to true, students will be sent email notifications upon enrollment.
action: Can either be set to “enroll” or “unenroll”. This determines the behavior
cohorts: Optional. If provided, the number of items in the list should be equal to the number of courses. first cohort coressponds with the first course and so on. The learners will be added to the corresponding cohort.
Response Values
If the supplied course data is valid and the enrollments were successful, an HTTP 200 “OK” response is returned.
The HTTP 200 response body contains a list of response data for each enrollment. (See the instructor.views.api.students_update_enrollment docstring for the specifics of the response data available for each enrollment)
If a cohorts list is provided, additional ‘cohort’ keys will be added to the ‘before’ and ‘after’ states.
- authentication_classes = (<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'openedx.core.lib.api.authentication.BearerAuthentication'>)#
- check_throttles(request)#
Check if request should be throttled. Raises an appropriate exception if the request is throttled.
- permission_classes = (<class 'edx_rest_framework_extensions.permissions.IsStaff'>,)#
- post(request)#
- throttle_classes = (<class 'openedx.core.djangoapps.enrollments.views.EnrollmentUserThrottle'>,)#