POST /api/v1/unit-instance/{unit}/new-assignment

Create a new assignment for students to complete. Only admins and lecturers can create assignments.

Path parameters

  • unit string Required

    UUID of the unit instance (unit offering)

application/json

Body Required

Assignment data including title, description, marks, dates, and max attempts

  • title string Required
  • description string Required
  • marks number Required
  • status string Required
  • releaseDate string(date-time) Required
  • dueDate string(date-time) Required
  • maxAttempts number Required

Responses

  • 201 application/json

    Assignment created successfully

  • 400

    Invalid assignment data

  • 403

    Forbidden - Admin or Lecturer role required

POST /api/v1/unit-instance/{unit}/new-assignment
curl \
 --request POST 'http://localhost:3500/api/v1/unit-instance/123e4567-e89b-12d3-a456-426614174000/new-assignment' \
 --header "Content-Type: application/json" \
 --data '{"marks":100,"title":"Algorithm Implementation Assignment","status":"DRAFT","dueDate":"2025-11-30T23:59:59Z","description":"Implement merge sort and quicksort algorithms","maxAttempts":3,"releaseDate":"2025-11-20T00:00:00Z"}'
Request examples
{
  "marks": 100,
  "title": "Algorithm Implementation Assignment",
  "status": "DRAFT",
  "dueDate": "2025-11-30T23:59:59Z",
  "description": "Implement merge sort and quicksort algorithms",
  "maxAttempts": 3,
  "releaseDate": "2025-11-20T00:00:00Z"
}
{
  "marks": 150,
  "title": "Data Structures Project",
  "status": "RELEASED",
  "dueDate": "2025-12-15T23:59:59Z",
  "description": "Build a complete binary search tree implementation",
  "maxAttempts": 1,
  "releaseDate": "2025-11-15T00:00:00Z"
}
Response examples (201)
{
  "message": "Assignment created successfully",
  "assignment": {
    "id": "assignment-321",
    "marks": 100,
    "title": "Algorithm Implementation Assignment",
    "status": "DRAFT",
    "dueDate": "2025-11-30T23:59:59Z",
    "createdAt": "2025-11-17T11:00:00Z",
    "description": "Implement merge sort and quicksort algorithms",
    "maxAttempts": 3,
    "releaseDate": "2025-11-20T00:00:00Z",
    "unitOfferingId": "123e4567-e89b-12d3-a456-426614174000"
  }
}