Skip to main content

Content assignment API

Assign a Published Collection or Class to a learner or an organization node, with an optional due date. Each Module in the content is pinned to the Version that the Version-resolution rule returns. Only admin users write; they act within their own subtree.

OperationRouteNotes
CreatePOST /api/assignmentscontentId, contentLevel (collection, class), targetType (node, user), targetId, optional dueDate. Returns the assignment with its Version pins.
ListGET /api/assignments?page=The caller's subtree, 50 per page (items, page, pageSize, totalCount).
UpdatePATCH /api/assignments/{id}status: "cancelled" or a new dueDate.
My assignmentsGET /api/assignments/meA learner's effective assignments from their current node, leaving out retired content.
Content searchGET /api/assignments/content-search?q=&targetType=&targetId=At most 20 Published, non-retired Collections and Classes that are available at the target (see Content availability API). targetType (node, user) and targetId go together: availability is judged at the target only when targetId is sent, and targetType is then required. An unknown targetType, or a targetId that matches no target, returns 404. Without targetId it uses the caller's own node.
Assign-to searchGET /api/assignments/target-search?q=At most 20 nodes and learners in the caller's subtree.

Errors​

401 not signed in. 403 not admin (including aztec_staff, teacher, student). 404 target outside the subtree. 409 a duplicate Active assignment, including two simultaneous identical requests. 422 unpublished or retired content, content that is not available at the target, a past due date, or a Module with no Version to pin (the message names the Module). A failed create saves nothing.

Rules​

  • A node or learner has at most one Active assignment per content (filtered unique index).
  • Cancelled is final; cancelling again changes nothing.
  • Node assignments are resolved from the learner's current node on every read.
  • Overlapping Active assignments give one effective assignment: the earliest due date, and the Version pins of the assignment created first.
  • Pins are only added. A Module added later is pinned the first time a learner needs it (IAssignmentPins).

Audit and telemetry​

Every write adds a row to the append-only AssignmentAudit table. Events: assignment_created, assignment_cancelled and assignment_blocked_unavailable.