POST /lessons/{lessonId}/resources

Adds a new resource (file, link, or media) to a lesson.

Path parameters

  • lessonId string Required

    The lesson ID

application/json

Body Required

  • lessonId string Required

    ID of the lesson

  • name string Required

    Name of the resource

    Maximum length is 200.

  • type string Required

    Type of resource

    Values are presentation, mindmap, document, video, audio, image, worksheet, equipment, or other.

  • url string(uri) | null

    URL of the resource

  • filePath string | null

    File path of the resource

  • description string | null

    Description of the resource

  • isRequired boolean | null

    Whether the resource is required

  • isPrepared boolean | null

    Whether the resource has been prepared

Responses

  • 201 application/json

    Lesson resource created successfully

    Hide response attributes Show response attributes object
    • success boolean
    • code integer(int32)
    • message string
    • data object

      Lesson resource representing teaching materials and resources

      Hide data attributes Show data attributes object
      • id string Required

        Unique identifier for the resource

      • lessonId string Required

        ID of the lesson

      • name string Required

        Name of the resource

        Maximum length is 200.

      • type string Required

        Type of resource

        Values are presentation, mindmap, document, video, audio, image, worksheet, equipment, or other.

      • url string(uri) | null

        URL of the resource

      • filePath string | null

        File path of the resource

      • description string | null

        Description of the resource

      • isRequired boolean

        Whether the resource is required for the lesson

      • isPrepared boolean

        Whether the resource has been prepared

      • createdAt string(date-time)

        Timestamp when the resource was created

  • 400 application/json

    Bad Request - Invalid input data or malformed request

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 401 application/json

    Unauthorized - Invalid or missing authentication token

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 404 application/json

    Lesson not found

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 500 application/json

    Internal Server Error

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
POST /lessons/{lessonId}/resources
curl \
 --request POST 'https://api.huy-devops.site/api/lessons/{lessonId}/resources' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"lessonId":"550e8400-e29b-41d4-a716-446655440005","name":"Quadratic Formula Worksheet","type":"document","url":"https://example.com/worksheet.pdf","filePath":"/uploads/worksheet.pdf","description":"string","isRequired":true,"isPrepared":false}'
Request examples
{
  "lessonId": "550e8400-e29b-41d4-a716-446655440005",
  "name": "Quadratic Formula Worksheet",
  "type": "document",
  "url": "https://example.com/worksheet.pdf",
  "filePath": "/uploads/worksheet.pdf",
  "description": "string",
  "isRequired": true,
  "isPrepared": false
}
Response examples (201)
{
  "success": true,
  "code": 200,
  "message": "string",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440006",
    "lessonId": "550e8400-e29b-41d4-a716-446655440005",
    "name": "Quadratic Formula Worksheet",
    "type": "document",
    "url": "https://example.com/worksheet.pdf",
    "filePath": "/uploads/worksheet.pdf",
    "description": "Practice worksheet for quadratic equations",
    "isRequired": true,
    "isPrepared": false,
    "createdAt": "2024-01-15T10:30:00Z"
  }
}
Response examples (400)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (401)
{
  "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"
}