Creates a new student and enrolls them in the specified class.
POST
/classes/{classId}/students
curl \
--request POST 'http://localhost:8080/api/classes/{classId}/students' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"email":"nguyen.van.a@example.com","lastName":"Van A","firstName":"Nguyen","phoneNumber":"+84987654321"}'
Request example
{
"email": "nguyen.van.a@example.com",
"lastName": "Van A",
"firstName": "Nguyen",
"phoneNumber": "+84987654321"
}
Response examples (200)
{
"code": 200,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440003",
"status": "active",
"userId": "user_002",
"address": "456 Elm St",
"lastName": "Thi B",
"password": "XyZ987!@#",
"username": "tran.thi.b@example.com",
"avatarUrl": "https://example.com/avatar2.jpg",
"createdAt": "2024-01-15T10:30:00Z",
"firstName": "Tran",
"updatedAt": "2024-09-20T14:45:00Z",
"phoneNumber": "+84981234567",
"enrollmentDate": "2024-01-15",
"parentContactEmail": "parent2@example.com"
},
"message": "Student created and enrolled successfully",
"success": true
}
Response examples (400)
{
"success": false,
"code": 42,
"errorCode": "string",
"message": "string",
"timestamp": "2026-05-04T09:42:00Z"
}
Response examples (404)
{
"success": false,
"code": 42,
"errorCode": "string",
"message": "string",
"timestamp": "2026-05-04T09:42:00Z"
}
Response examples (500)
{
"success": false,
"code": 42,
"errorCode": "string",
"message": "string",
"timestamp": "2026-05-04T09:42:00Z"
}