POST /api/v1/unit-instance/{unit}/{topic}/new-lesson

Add a new lesson to a specific topic within the unit. Lessons are the primary learning content units. Only admins and lecturers can create lessons.

Path parameters

  • unit string Required

    UUID of the unit instance (unit offering)

  • topic string Required

    UUID of the topic to add lesson to

application/json

Body Required

Lesson data including title, description, content, and materials

  • title string Required
  • description string Required

Responses

  • 201 application/json

    Lesson created successfully

  • 400

    Invalid lesson data

  • 403

    Forbidden - Admin or Lecturer role required

  • 404

    Topic not found

POST /api/v1/unit-instance/{unit}/{topic}/new-lesson
curl \
 --request POST 'http://localhost:3500/api/v1/unit-instance/123e4567-e89b-12d3-a456-426614174000/topic-123/new-lesson' \
 --header "Content-Type: application/json" \
 --data '{"type":"NORMAL","title":"Introduction to Binary Search","duration":45,"orderIndex":1,"description":"Learn how binary search works with examples"}'
Request example
{
  "type": "NORMAL",
  "title": "Introduction to Binary Search",
  "duration": 45,
  "orderIndex": 1,
  "description": "Learn how binary search works with examples"
}
Response examples (201)
{
  "lesson": {
    "id": "lesson-456",
    "type": "NORMAL",
    "title": "Introduction to Binary Search",
    "topicId": "topic-123",
    "duration": 45,
    "createdAt": "2025-11-17T10:30:00Z"
  },
  "message": "Lesson created successfully"
}