openapi: 3.0.3 info: title: Open edX agreements enrollment API description: APIs for access to Open edX information contact: email: dl@kaznu.kz version: v1 servers: - url: https://open.kaznu.kz/api security: - Basic: [] tags: - name: enrollment paths: /enrollment/v1/course/{course_id}: get: operationId: enrollment_v1_course_read summary: Read enrollment information for a particular course. description: HTTP Endpoint for retrieving course level enrollment information. tags: - enrollment parameters: - name: course_id in: path required: true schema: type: string responses: '200': description: '' /enrollment/v1/enrollment: get: operationId: enrollment_v1_enrollment_list summary: Gets a list of all course enrollments for a user. description: 'Returns a list for the currently logged in user, or for the user named by the ''user'' GET parameter. If the username does not match that of the currently logged in user, only courses for which the currently logged in user has the Staff or Admin role are listed. As a result, a course team member can find out which of their own courses a particular learner is enrolled in. Only the Staff or Admin role (granted on the Django administrative console as the staff or instructor permission) in individual courses gives the requesting user access to enrollment data. Permissions granted at the organizational level do not give a user access to enrollment data for all of that organization''s courses. Users who have the global staff permission can access all enrollment data for all courses.' tags: - enrollment responses: '200': description: '' post: operationId: enrollment_v1_enrollment_create summary: Enrolls the currently logged-in user in a course. description: 'Server-to-server calls may deactivate or modify the mode of existing enrollments. All other requests go through `add_enrollment()`, which allows creation of new and reactivation of old enrollments.' tags: - enrollment responses: '201': description: '' /enrollment/v1/enrollment/{course_id}: get: operationId: enrollment_v1_enrollment_read summary: Create, read, or update enrollment information for a user. description: 'HTTP Endpoint for all CRUD operations for a user course enrollment. Allows creation, reading, and updates of the current enrollment for a particular course.' tags: - enrollment parameters: - name: course_id in: path required: true schema: type: string responses: '200': description: '' /enrollment/v1/enrollment/{username},{course_id}: get: operationId: enrollment_v1_enrollment_read summary: Create, read, or update enrollment information for a user. description: 'HTTP Endpoint for all CRUD operations for a user course enrollment. Allows creation, reading, and updates of the current enrollment for a particular course.' tags: - enrollment parameters: - name: username in: path required: true schema: type: string - name: course_id in: path required: true schema: type: string responses: '200': description: '' /enrollment/v1/enrollment_allowed/: get: operationId: enrollment_v1_enrollment_allowed_list summary: Returns the enrollments allowed for a given user email. description: '**Example Requests** GET /api/enrollment/v1/enrollment_allowed?email=user@example.com **Parameters** - `email` (optional, string, _query_params_) - defaults to the calling user if not provided. **Responses** - 200: Success. - 403: Forbidden, you need to be staff.' tags: - enrollment responses: '200': description: '' post: operationId: enrollment_v1_enrollment_allowed_create summary: Creates an enrollment allowed for a given user email and course id. description: '**Example Request** POST /api/enrollment/v1/enrollment_allowed/' tags: - enrollment responses: '201': description: '' delete: operationId: enrollment_v1_enrollment_allowed_delete summary: Deletes an enrollment allowed for a given user email and course id. description: '**Example Request** DELETE /api/enrollment/v1/enrollment_allowed/' tags: - enrollment responses: '204': description: '' /enrollment/v1/enrollments/: get: operationId: enrollment_v1_enrollments_list summary: '**Use Cases**' description: "Get a list of all course enrollments, optionally filtered by a course ID or list of usernames.\n\n**Example Requests**\n\n GET /api/enrollment/v1/enrollments\n\n GET /api/enrollment/v1/enrollments?course_id={course_id}\n\n GET /api/enrollment/v1/enrollments?username={username},{username},{username}\n\n GET /api/enrollment/v1/enrollments?course_id={course_id}&username={username}\n\n GET /api/enrollment/v1/enrollments?email={email},{email}\n\n**Query Parameters for GET**\n\n * course_id: Filters the result to course enrollments for the course corresponding to the\n given course ID. The value must be URL encoded. Optional.\n\n * username: List of comma-separated usernames. Filters the result to the course enrollments\n of the given users. Optional.\n\n * email: List of comma-separated emails. Filters the result to the course enrollments\n of the given users. Optional.\n\n * page_size: Number of results to return per page. Optional.\n\n * page: Page number to retrieve. Optional.\n\n**Response Values**\n\n If the request for information about the course enrollments is successful, an HTTP 200 \"OK\" response\n is returned.\n\n The HTTP 200 response has the following values.\n\n * results: A list of the course enrollments matching the request.\n\n * created: Date and time when the course enrollment was created.\n\n * mode: Mode for the course enrollment.\n\n * is_active: Whether the course enrollment is active or not.\n\n * user: Username of the user in the course enrollment.\n\n * course_id: Course ID of the course in the course enrollment.\n\n * next: The URL to the next page of results, or null if this is the\n last page.\n\n * previous: The URL to the next page of results, or null if this\n is the first page.\n\n If the user is not logged in, a 401 error is returned.\n\n If the user is not global staff, a 403 error is returned.\n\n If the specified course_id is not valid or any of the specified usernames\n are not valid, a 400 error is returned.\n\n If the specified course_id does not correspond to a valid course or if all the specified\n usernames do not correspond to valid users, an HTTP 200 \"OK\" response is returned with an\n empty 'results' field." tags: - enrollment parameters: - name: cursor in: query required: false description: The pagination cursor value. schema: type: string - name: page_size in: query required: false description: Number of results to return per page. schema: type: integer responses: '200': description: '' content: application/json: schema: required: - results type: object properties: next: type: string format: uri nullable: true previous: type: string format: uri nullable: true results: type: array items: $ref: '#/components/schemas/CourseEnrollmentsApiList' /enrollment/v1/roles/: get: operationId: enrollment_v1_roles_list description: Gets a list of all roles for the currently logged-in user, filtered by course_id if supplied tags: - enrollment responses: '200': description: '' /enrollment/v1/unenroll/: post: operationId: enrollment_v1_unenroll_create description: Unenrolls the specified user from all courses. tags: - enrollment responses: '201': description: '' components: schemas: CourseEnrollmentsApiList: required: - course_id type: object properties: created: title: Created type: string format: date-time readOnly: true nullable: true mode: title: Mode type: string maxLength: 100 minLength: 1 is_active: title: Is active type: boolean user: title: User type: string readOnly: true course_id: title: Course id type: string minLength: 1 securitySchemes: Basic: type: http scheme: basic