Enroll Student to Course
The enrollStudentToCourse
mutation allows you to enroll a student to a specified course, or update existing enrollment details.
Input Parameters
Field | Type | Description |
---|---|---|
courseId | String! | ID of the course to enroll the student into |
userId | String | ID of the student (User) to enroll |
email | String | Email of the student. If user doesn’t exist, a placeholder user will be created |
name | String | Name of the student. Required when creating a new user |
planId | String | ID of the curriculum plan to apply to this enrollment |
endedAt | Int | Optional expiration date for the enrollment (Unix Timestamp) |
Return Fields
The created or updated enrollment(StudentCourseShip)
Field | Type | Description |
---|---|---|
id | String! | id of the enrollment |
completionRate | Float | the completion rate of the enrolled course which student achieved |
course | AdminCourse! | information of the enrolled course |
user | AdminUser! | user information of the enrolled course |
updatedAt | Int! | last updated date of the enrollment |
createdAt | Int! | created date of the enrollment |
endedAt | Int | expiration date for the enrollment (Unix Timestamp) |
type EnrollStudentToCoursePayload { enrollment { id completionRate course { id slug } user { id name email } }}
Example
mutation { enrollStudentToCourse( courseId: "ab6ee332-614d-475d-93b5-abc5ebb1fc84" name: "studentB" ) { enrollment { id completionRate course { id slug } user { id name email } } }}
Sample Response
{ "data": { "enrollStudentToCourse": { "enrollment": { "id": "619ad939-8591-40ad-9364-cf3825a9bf70", "completionRate": 0.0, "createdAt": 1672531200, "updatedAt": 1672531200, "endedAt": null, "course": { "id": "ab6ee332-614d-475d-93b5-abc5ebb1fc84", "slug": "course-slug" }, "user": { "id": "387b0c87-0f85-44cc-833e-7306c1b5d3e6", "name": "studentB", } } } }}