GET /api/v1/materials/unit/{unitOfferingId}/type/{filetype}

Filter and retrieve materials by file type within a specific unit offering.

Supported File Types:

  • Documents: pdf, doc, docx, ppt, pptx, txt, odt, rtf, xls, xlsx, csv
  • Images: jpg, jpeg, png, gif, bmp, tiff, svg, webp
  • Videos: mp4, webm, avi, mov, wmv, flv, mkv
  • Audio: mp3, wav, ogg, flac, aac, m4a
  • Archives: zip, rar, 7z, tar, gz
  • Code: html, css, js, py, java, cpp, c, php, json, xml
  • Other: Most standard file types are supported

Note: Only non-executable and safe file types are allowed

Use Cases:

  • Filter materials by type (e.g., only videos)
  • Download all PDFs from a course
  • Media gallery creation
  • File type analytics

Path parameters

  • unitOfferingId string Required

    UUID of the unit offering

  • filetype string Required

    File type to filter by (case insensitive)

Responses

  • 200 application/json

    Materials filtered by file type successfully

    Hide response attributes Show response attributes object
    • unitOffering object
      Hide unitOffering attributes Show unitOffering attributes object
      • id string
      • code string
    • filetype string
    • materials array[object]
      Hide materials attributes Show materials attributes object
      • id string
      • title string
      • originalName string
      • filetype string
      • fileUrl string
      • lessons array[object]
        Hide lessons attributes Show lessons attributes object
        • id string
        • title string
        • topic string
    • totalMaterials number
  • 400 application/json

    Default bad request error 400 response

    Hide response attributes Show response attributes object
    • message string Required

      Response message

    • error string Required
    • statusCode number Required
GET /api/v1/materials/unit/{unitOfferingId}/type/{filetype}
curl \
 --request GET 'http://localhost:3500/api/v1/materials/unit/987fcdeb-51a2-4567-9876-543210987654/type/pdf'
Response examples (200)
{
  "unitOffering": {
    "id": "string",
    "code": "CS101"
  },
  "filetype": "pdf",
  "materials": [
    {
      "id": "string",
      "title": "string",
      "originalName": "string",
      "filetype": "string",
      "fileUrl": "string",
      "lessons": [
        {
          "id": "string",
          "title": "string",
          "topic": "string"
        }
      ]
    }
  ],
  "totalMaterials": 8
}
Response examples (400)
{
  "message": "string",
  "error": "string",
  "statusCode": 42.0
}